#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e3 + 7;
int n, m;
const int Max = 5e5 + 7;
int a[Max], b[Max];
bitset<MAX> inv[MAX], temp[MAX];
void func() {
  for (int i = 1; i <= n; i++) inv[i][i] = 1;
  for (int i = 1; i <= n; i++) {
    if (temp[i][i] != 1)
      for (int j = i + 1; j <= n; j++)
        if (temp[j][i] == 1) {
          swap(temp[i], temp[j]);
          swap(inv[i], inv[j]);
          break;
        }
    for (int j = 1; j <= n; j++)
      if (i != j && temp[j][i]) {
        temp[j] = temp[j] ^ temp[i];
        inv[j] = inv[j] ^ inv[i];
      }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &a[i], &b[i]);
    temp[a[i]][b[i]] = 1;
  }
  func();
  for (int i = 1; i <= m; i++)
    if (inv[b[i]][a[i]])
      printf("NO\n");
    else
      printf("YES\n");
  return 0;
}
