#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 500010;
const int INF = 1e9;
int N, M;
bitset<4010> b[2010], a[2010];
int U[MAXN + 1], V[MAXN + 1];
inline void Gauss(int n) {
  for (int i = 1; i <= N; i++) {
    if (a[n][i]) {
      if (!b[i][i]) {
        b[i] = a[n];
        break;
      }
      a[n] ^= b[i];
    }
  }
  return;
}
inline void print() {
  cout << endl;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= 2 * N; j++) cout << b[i][j] << " ";
    cout << endl;
  }
}
int main() {
  N = read(), M = read();
  for (int i = 1; i <= M; i++) {
    int u = read(), v = read();
    a[u][v] = 1;
    U[i] = u, V[i] = v;
  }
  for (int i = 1; i <= N; i++) a[i][i + N] = 1, Gauss(i);
  for (int i = N; i >= 1; i--) {
    for (int j = i + 1; j <= N; j++) {
      if (b[i][j]) b[i] ^= b[j];
    }
  }
  for (int i = 1; i <= M; i++) puts((b[V[i]][U[i] + N] ? "NO" : "YES"));
  return 0;
}
