#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline T1 max(T1 a, T2 b) {
  return a < b ? b : a;
}
template <typename T1, typename T2>
inline T1 min(T1 a, T2 b) {
  return a < b ? a : b;
}
const char lf = '\n';
namespace ae86 {
const int bufl = 1 << 15;
char buf[bufl], *s = buf, *t = buf;
inline int fetch() {
  if (s == t) {
    t = (s = buf) + fread(buf, 1, bufl, stdin);
    if (s == t) return EOF;
  }
  return *s++;
}
inline int ty() {
  int a = 0, b = 1, c = fetch();
  while (!isdigit(c)) b ^= c == '-', c = fetch();
  while (isdigit(c)) a = a * 10 + c - 48, c = fetch();
  return b ? a : -a;
}
}  // namespace ae86
using ae86::ty;
const int _ = 2007, __ = _ + _, _e = 500007;
int n, m, ea[_e], eb[_e];
bitset<__> f[_];
int main() {
  ios::sync_with_stdio(0), cout.tie(nullptr);
  n = ty(), m = ty();
  for (int i = 1; i <= m; i++) ea[i] = ty(), eb[i] = ty(), f[ea[i]][eb[i]] = 1;
  for (int i = 1; i <= n; i++) f[i][n + i] = 1;
  for (int i = 1; i <= n; i++) {
    int a = i;
    while (a < n && !f[a][i]) a++;
    if (!f[a][i]) throw "cyka blyat";
    swap(f[i], f[a]);
    for (int j = 1; j <= n; j++)
      if (j != i && f[j][i]) f[j] ^= f[i];
  }
  for (int i = 1; i <= m; i++)
    cout << (f[eb[i]][ea[i] + n] ? "NO" : "YES") << lf;
  return 0;
}
