#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000 + 10, E = 1e6;
bitset<maxn * 2> b[maxn];
int from[E], to[E];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    b[u][v] = b[u][u + n] = 1;
    from[i] = u, to[i] = v;
  }
  for (int i = 0; i < n; i++) {
    int row = -1;
    for (int j = i; j < n && row == -1; j++)
      if (b[j][i]) row = j;
    assert(row != -1);
    for (int it = 0; it < 2 * n; it++) {
      bool tmp = b[i][it];
      b[i][it] = b[row][it];
      b[row][it] = tmp;
    }
    for (int j = 0; j < n; j++)
      if (j != i && b[j][i] == 1) b[j] ^= b[i];
  }
  for (int i = 0; i < m; i++) {
    int u = from[i], v = to[i];
    int t = b[v][u + n];
    cout << (t == 0 ? "YES" : "NO") << endl;
  }
}
