#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005;
int n, m;
bitset<maxn> a[maxn], b[maxn];
int e[500005][2];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &e[i][0], &e[i][1]);
    a[e[i][1]][e[i][0]] = 1;
  }
  for (int i = 1; i <= n; ++i) b[i][i] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = i; j <= n; ++j)
      if (a[j][i]) {
        swap(a[i], a[j]);
        swap(b[i], b[j]);
        break;
      }
    if (!a[i][i]) continue;
    for (int j = 1; j <= n; ++j)
      if (i != j && a[j][i]) {
        a[j] ^= a[i];
        b[j] ^= b[i];
      }
  }
  for (int i = 1; i <= m; ++i) puts(b[e[i][0]][e[i][1]] ? "NO" : "YES");
  return 0;
}
