#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000 + 10;
bitset<maxn> a[maxn], b[maxn];
int ask[500000 + 10][2];
int i, j, k, l, t, n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &j, &k);
    ask[i][0] = j;
    ask[i][1] = k;
    a[j][k] = 1;
  }
  for (i = 1; i <= n; i++) b[i][i] = 1;
  for (i = 1; i <= n; i++) {
    for (j = i; j <= n; j++)
      if (a[j][i] == 1) break;
    swap(a[i], a[j]);
    swap(b[i], b[j]);
    for (j = 1; j <= n; j++)
      if (a[j][i] == 1 && i != j) {
        a[j] ^= a[i];
        b[j] ^= b[i];
      }
  }
  for (i = 1; i <= m; i++) {
    j = ask[i][0];
    k = ask[i][1];
    if (b[k][j] != 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
}
