#include <bits/stdc++.h>
using namespace std;
int n, m;
int v1[500010], v2[500010];
unsigned long long a[2010][2010 / 64 + 5], b[2010][2010 / 64 + 5];
int N;
int p1(int x) { return (x - 1) / 64 + 1; }
int p2(int x) { return (x - 1) % 64; }
int wa(int x, int y) { return (a[x][p1(y)] >> p2(y)) & 1; }
int wb(int x, int y) { return (b[x][p1(y)] >> p2(y)) & 1; }
void gs() {
  int i, j, k;
  for (i = 1; i <= n; i++) {
    if (!wa(i, i)) {
      for (j = i + 1; j <= n; j++) {
        if (wa(j, i)) {
          for (k = 1; k <= N; k++) {
            swap(a[i][k], a[j][k]);
            swap(b[i][k], b[j][k]);
          }
        }
      }
    }
    for (j = 1; j <= n; j++) {
      if (i != j) {
        if (wa(j, i)) {
          for (k = 1; k <= N; k++) {
            a[j][k] ^= a[i][k];
            b[j][k] ^= b[i][k];
          }
        }
      }
    }
  }
}
int main() {
  int i;
  scanf("%d%d", &n, &m);
  N = (n - 1) / 64 + 1;
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &v1[i], &v2[i]);
    a[v1[i]][p1(v2[i])] |= 1ull << p2(v2[i]);
  }
  for (i = 1; i <= n; i++) {
    b[i][p1(i)] |= 1ull << p2(i);
  }
  gs();
  for (i = 1; i <= m; i++) {
    printf(wb(v2[i], v1[i]) ? "NO\n" : "YES\n");
  }
  return 0;
}
