#include <bits/stdc++.h>
using namespace std;
const int N = 2010, M = 500010;
bitset<N> A[N], B[N];
pair<int, int> E[M];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    A[u][v] = 1;
    E[i] = make_pair(u, v);
  }
  for (int i = 1; i <= n; i++) B[i][i] = 1;
  for (int i = 1; i <= n; i++) {
    int k = i;
    for (int j = i; j <= n; j++)
      if (A[j][i]) {
        k = j;
        break;
      }
    swap(A[i], A[k]), swap(B[i], B[k]);
    for (int j = 1; j <= n; j++)
      if (i != j && A[j][i]) A[j] ^= A[i], B[j] ^= B[i];
  }
  for (int i = 1; i <= m; i++) puts(B[E[i].second][E[i].first] ? "NO" : "YES");
  return 0;
}
