#include <bits/stdc++.h>
using namespace std;
int n, q;
int a[500005], b[500005];
bitset<2005> A[2005], B[2005];
void calc_inv() {
  for (int i = 1; i <= n; i++) {
    int j = i;
    while (!A[j][i]) j++;
    swap(A[j], A[i]), swap(B[j], B[i]);
    for (int j = 1; j <= n; j++) {
      if (j == i || !A[j][i]) continue;
      A[j] ^= A[i], B[j] ^= B[i];
    }
  }
}
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 0; i < q; i++) {
    scanf("%d %d", &a[i], &b[i]);
    A[a[i]][b[i]] = 1;
  }
  for (int i = 1; i <= n; i++) B[i][i] = 1;
  calc_inv();
  for (int i = 0; i < q; i++) {
    if (!B[b[i]][a[i]])
      puts("YES");
    else
      puts("NO");
  }
}
