#include <bits/stdc++.h>
using namespace std;
int n, m;
bitset<4040> a[2020];
int xx[500500], yy[500500];
void Gauss() {
  int t;
  for (register int i = 1; i <= n; ++i) {
    t = i;
    if (!a[i][i])
      for (register int j = i + 1; j <= n; ++j)
        if (a[j][i]) {
          t = j;
          break;
        }
    if (t != i) swap(a[i], a[t]);
    if (!a[i][i]) continue;
    for (register int j = 1; j <= n; ++j)
      if (a[j][i] && i != j) a[j] ^= a[i];
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i)
    scanf("%d%d", &xx[i], &yy[i]), a[xx[i]][yy[i]] = 1;
  for (int i = 1; i <= n; ++i) a[i][n + i] = 1;
  Gauss();
  for (int i = 1; i <= m; ++i)
    if (a[yy[i]][xx[i] + n])
      puts("NO");
    else
      puts("YES");
  return 0;
}
