#include <bits/stdc++.h>
using namespace std;
constexpr int maxn = 2010;
using mat = array<bitset<maxn>, maxn>;
static mat inverse(int n, mat in) {
  mat out = {};
  for (int i = 0; i < n; ++i) {
    out[i][i] = 1;
  }
  for (int i = 0; i < n; ++i) {
    int j = i;
    while (!in[j][i]) ++j;
    assert(j < n);
    if (j != i) swap(in[i], in[j]), swap(out[i], out[j]);
    for (int j = 0; j < n; ++j) {
      if (i == j || !in[j][i]) continue;
      in[j] ^= in[i];
      out[j] ^= out[i];
    }
  }
  return out;
}
static mat transpose(int n, mat in) {
  mat out;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      out[j][i] = in[i][j];
    }
  }
  return out;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  mat a = {};
  cin >> n >> m;
  vector<pair<int, int>> mucs(m);
  for (auto& p : mucs) {
    cin >> p.first >> p.second;
    --p.first, --p.second;
    a[p.first][p.second] = 1;
  }
  mat minors = transpose(n, inverse(n, a));
  for (const auto p : mucs) {
    cout << (minors[p.first][p.second] ? "NO\n" : "YES\n");
  }
  return 0;
}
