#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e3 + 10;
int n, m;
bitset<maxn> x[maxn], inv[maxn];
vector<pair<int, int> > edge;
void gauss() {
  for (int i = 1; i <= n; ++i) {
    for (int j = i; j <= n; ++j)
      if (x[j][i]) {
        swap(x[i], x[j]);
        swap(inv[i], inv[j]);
        break;
      }
    for (int j = 1; j <= n; ++j)
      if (j != i && x[j][i]) {
        x[j] ^= x[i];
        inv[j] ^= inv[i];
      }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) inv[i][i] = 1;
  for (int i = 1; i <= m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    edge.emplace_back(a, b);
    x[a][b] = 1;
  }
  gauss();
  for (auto e : edge) {
    int a = e.first, b = e.second;
    if (inv[b][a])
      puts("NO");
    else
      puts("YES");
  }
  return 0;
}
