#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2005;
namespace MAT {
int n;
bitset<MAXN> mat[MAXN], adj[MAXN];
void getAdj() {
  for (int i = 1; i <= n; i++) adj[i][i] = 1;
  for (int j = 1; j <= n; j++) {
    for (int i = j + 1; i <= n && !mat[j][j]; i++)
      if (mat[i][j]) {
        swap(mat[i], mat[j]), swap(adj[i], adj[j]);
      }
    for (int i = j + 1; i <= n; i++)
      if (mat[i][j]) {
        mat[i] ^= mat[j], adj[i] ^= adj[j];
      }
  }
  for (int j = n; j >= 1; j--) {
    for (int i = j - 1; i >= 1; i--)
      if (mat[i][j]) {
        mat[i] ^= mat[j], adj[i] ^= adj[j];
      }
  }
}
}  // namespace MAT
int a[500005], b[500005];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  MAT::n = n;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &a[i], &b[i]);
    MAT::mat[a[i]][b[i]] = 1;
  }
  MAT::getAdj();
  for (int i = 1; i <= m; i++) {
    puts(MAT::adj[b[i]][a[i]] ? "NO" : "YES");
  }
  return 0;
}
