#include <bits/stdc++.h>
using namespace std;
const int N = 2001;
const int M = 500010;
int g[N][N], n, m, x, y, r[N];
bool ans[M];
bitset<N * 2> s[N], f[N];
int read() {
  int ans = 0;
  char last = ' ', ch = getchar();
  while (ch >= '0' && ch <= '9') ans = ans * 10 + ch - '0', ch = getchar();
  return ans;
}
inline void work(int x) {
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = cnt + 1; j <= n; j++)
      if (f[j][i] == 1) {
        cnt++;
        r[cnt] = i;
        swap(f[cnt], f[j]);
        for (int k = 1; k <= n; k++)
          if (k != cnt && f[k][i] == 1) {
            f[k] ^= f[cnt];
          }
        break;
      }
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (f[i][j + n] == 0) ans[g[j][i]] = true;
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= m; i++) {
    x = read(), y = read();
    g[x][y] = i;
    s[x].set(y);
  }
  for (int i = 1; i <= n; i++) f[i] = s[i];
  for (int i = 1; i <= n; i++) f[i][i + n] = 1;
  work(0);
  for (int i = 1; i <= m; i++)
    if (ans[i])
      puts("YES");
    else
      puts("NO");
  return 0;
}
