#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read() {
  register T sum = 0;
  register char cc = getchar();
  int sym = 1;
  while (cc != '-' && (cc > '9' || cc < '0')) cc = getchar();
  if (cc == '-') sym = -1, cc = getchar();
  sum = sum * 10 + cc - '0';
  cc = getchar();
  while (cc >= '0' && cc <= '9') sum = sum * 10 + cc - '0', cc = getchar();
  return sym * sum;
}
template <typename T>
inline T read(T& a) {
  a = read<T>();
  return a;
}
template <typename T, typename... Others>
inline void read(T& a, Others&... b) {
  a = read(a);
  read(b...);
}
int n, m, st[500010], ed[500010];
bitset<2010> a[2010], b[2010];
void Guass() {
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      if (a[j][i]) {
        if (i != j) {
          swap(a[i], a[j]);
          swap(b[i], b[j]);
        }
        break;
      }
    }
    for (int j = 1; j <= n; j++) {
      if (i != j && a[j][i]) {
        a[j] ^= a[i];
        b[j] ^= b[i];
      }
    }
  }
}
int main() {
  read(n, m);
  for (int i = 1; i <= m; i++) {
    read(st[i], ed[i]);
    a[st[i]][ed[i]] = 1;
  }
  for (int i = 1; i <= n; i++) b[i][i] = 1;
  Guass();
  for (int i = 1; i <= m; i++) puts(b[ed[i]][st[i]] ? "NO" : "YES");
  return 0;
}
