#include <bits/stdc++.h>
using namespace std;
vector<bitset<2000>> inv(vector<bitset<2000>> &M) {
  const int N = M.size();
  vector<bitset<2000>> ans(N);
  for (int i = 0; i < N; i++) ans[i].set(i);
  for (int i = 0; i < N; i++) {
    int j = i;
    while (!M[j].test(i)) j++;
    swap(M[i], M[j]);
    swap(ans[i], ans[j]);
    for (int j = 0; j < N; j++)
      if (j != i && M[j][i]) {
        M[j] ^= M[i];
        ans[j] ^= ans[i];
      }
  }
  return ans;
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<bitset<2000>> M(n);
  vector<pair<int, int>> in;
  in.reserve(m);
  while (m--) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--;
    b--;
    M[a].set(b);
    in.emplace_back(a, b);
  }
  M = inv(M);
  for (auto &x : in) printf("%s\n", M[x.second][x.first] ? "NO" : "YES");
  return 0;
}
