#include <bits/stdc++.h>
const int kN = 2000 + 5;
const int kM = 500000 + 5;
std::bitset<kN + kN> bits[kN];
int a[kM], b[kM];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    bits[a].set(b, 1);
    ::a[i] = a;
    ::b[i] = b;
  }
  for (int i = 0; i < n; ++i) {
    bits[i].set(n + i, 1);
  }
  for (int i = 0, k = 0; k < n; ++k) {
    i = k;
    while (bits[i].test(k) == false) ++i;
    std::swap(bits[i], bits[k]);
    for (int j = 0; j < n; ++j) {
      if (j != k && bits[j].test(k)) bits[j] ^= bits[k];
    }
  }
  for (int i = 0; i < m; ++i) {
    puts(!bits[b[i]].test(n + a[i]) ? "YES" : "NO");
  }
}
