#include <bits/stdc++.h>
using namespace std;bool ok(int x, int n, const vector<pair<int, int>>& edges)
{vector<vector<int>> G(n);vector<int> deg(n);for (int i = 0; i < x; i++){G[edges[i].first].push_back(edges[i].second);++deg[edges[i].second];}queue<int> q;for (int i = 0; i < n; i++)if (!deg[i]) q.push(i);int tot = 0;while (!q.empty()){int u = q.front();q.pop();++tot;for (auto& v : G[u])if (--deg[v] == 0) q.push(v);}return tot == n;
}int main()
{int n, m;scanf("%d%d", &n, &m);vector<pair<int, int>> edges;for (int i = 0, u, v; i < m; i++){scanf("%d%d", &u, &v);--u, --v;edges.emplace_back(u, v);}int l = 1, r = m, ans;while (l <= r){int mid = l + r >> 1;if (ok(mid, n, edges))l = mid + 1, ans = mid;elser = mid - 1;}for (int i = 0; i < ans; i++) puts("Yes");for (int i = ans; i < m; i++) puts("No");
}