#include <bits/stdc++.h>
using namespace std;
int N, M;
int U[500005], V[500005];
bitset<2005> A[2005], B[2005];
int main() {
  int i, j;
  scanf("%d%d", &N, &M);
  for (i = 1; i <= M; i++) {
    scanf("%d%d", &U[i], &V[i]);
    A[U[i]][V[i]] = 1;
  }
  for (i = 1; i <= N; i++) B[i][i] = 1;
  for (i = 1; i <= N; i++) {
    for (j = i; j <= N && !A[j][i]; j++)
      ;
    swap(A[i], A[j]), swap(B[i], B[j]);
    for (j = 1; j <= N; j++)
      if (i ^ j && A[j][i]) A[j] ^= A[i], B[j] ^= B[i];
  }
  for (i = 1; i <= M; i++) puts(B[V[i]][U[i]] ? "NO" : "YES");
  return 0;
}
