#include <bits/stdc++.h>
using namespace std;
const int maxn = 2010;
const int maxm = 5e5 + 10;
int n, m, a[maxm], b[maxm];
bitset<maxn> g[maxn], C[maxn];
int main() {
  int i, j;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &a[i], &b[i]);
    g[a[i]].set(b[i]);
  }
  for (i = 1; i <= n; i++) C[i].set(i);
  for (i = 1; i <= n; i++) {
    if (!g[i][i])
      for (j = i + 1; j <= n; j++)
        if (g[j][i]) swap(g[j], g[i]), swap(C[j], C[i]);
    for (j = 1; j <= n; j++)
      if (i != j && g[j][i]) g[j] ^= g[i], C[j] ^= C[i];
  }
  for (i = 1; i <= m; i++) puts(C[b[i]][a[i]] ? "NO" : "YES");
  return 0;
}
