#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int first = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) {
    if (ch == '-') f = -1;
  }
  for (; isdigit(ch); ch = getchar()) {
    first = first * 10 + ch - 48;
  }
  return first * f;
}
const int mxN = 2000;
const int mxM = 5e5;
int n, m;
bitset<mxN * 2 + 5> a[mxN + 3];
int ax[mxM + 3], ay[mxM + 3];
void gauss() {
  for (int i = 1; i <= n; i++) {
    if (!a[i][i]) {
      for (int j = i + 1; j <= n; j++)
        if (a[j][i]) {
          swap(a[i], a[j]);
          break;
        }
    }
    for (int j = i + 1; j <= n; j++) {
      if (a[j][i]) {
        a[j] ^= a[i];
      }
    }
  }
  for (int i = n; i >= 1; i--) {
    for (int j = i + 1; j <= n; j++)
      if (a[i][j]) {
        a[i] ^= a[j];
      }
  }
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= m; i++) {
    ax[i] = read(), ay[i] = read();
    a[ax[i]][ay[i]] = 1;
  }
  for (int i = 1; i <= n; i++) a[i][n + i] = 1;
  gauss();
  for (int i = 1; i <= m; i++) {
    if (a[ay[i]][ax[i] + n]) {
      puts("NO");
    } else {
      puts("YES");
    }
  }
  return 0;
}
