#include <bits/stdc++.h>
using namespace std;
int pa[500010], pb[500010];
bitset<4001> v[2005];
int n, m;
inline int rd() {
  int ret = 0, f = 1;
  char gc = getchar();
  while (gc < '0' || gc > '9') {
    if (gc == '-') f = -f;
    gc = getchar();
  }
  while (gc >= '0' && gc <= '9') ret = ret * 10 + (gc ^ '0'), gc = getchar();
  return ret * f;
}
int main() {
  n = rd(), m = rd();
  int i, j;
  for (i = 1; i <= m; i++)
    pa[i] = rd() - 1, pb[i] = rd() - 1, v[pa[i]][pb[i]] = 1;
  for (i = 0; i < n; i++) v[i][i + n] = 1;
  for (i = 0; i < n; i++) {
    if (!v[i][i]) {
      for (j = i + 1; j < n; j++)
        if (v[j][i]) break;
      swap(v[j], v[i]);
    }
    for (j = 0; j < n; j++)
      if (j != i && v[j][i]) v[j] ^= v[i];
  }
  for (i = 1; i <= m; i++) {
    if (v[pb[i]][pa[i] + n])
      puts("NO");
    else
      puts("YES");
  }
  return 0;
}
