#include <bits/stdc++.h>
using namespace std;
const int UNDEF = -1;
const int INF = 1e9;
template <typename T>
inline bool chkmax(T &aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T &aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
struct debugger {
  template <typename T>
  debugger &operator,(const T &v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
const int mn = 2000;
const int ymax = (mn + 63) / 64;
int firstone[mn];
unsigned long long g[mn][ymax];
unsigned long long id[mn][ymax];
void gauss(int n, int m) {
  for (int x = 0; x < n; x++) firstone[x] = -1;
  int ylim = (m + 63) / 64;
  int initx = 0;
  for (int b = 0; b < m; b++) {
    unsigned long long bm = 1ULL << (b % 64);
    int toswap = -1;
    for (int x = initx; x < n; x++) {
      if (g[x][b / 64] & bm) {
        toswap = x;
        break;
      }
    }
    if (toswap == -1) {
      assert(false);
      continue;
    }
    for (int y = 0; y < ylim; y++) {
      swap(g[toswap][y], g[initx][y]);
    }
    swap(id[toswap], id[initx]);
    for (int x = initx + 1; x < n; x++) {
      if (g[x][b / 64] & bm) {
        for (int y = 0; y < ylim; y++) {
          g[x][y] ^= g[initx][y];
          id[x][y] ^= id[initx][y];
        }
      }
    }
    firstone[initx] = b;
    initx++;
  }
  for (int x = 0; x < n; x++) {
  }
}
unsigned long long sol[ymax];
unsigned long long want[ymax];
bool solve(int n, int m) {
  memset(sol, 0, sizeof sol);
  int ylim = (m + 63) / 64;
  int initx = 0;
  for (int b = 0; b < m; b++) {
    if (0ULL == (want[b / 64] & (1ULL << (b % 64)))) continue;
    int found = -1;
    for (int x = initx; x < n; x++) {
      if (firstone[x] == b) {
        found = x;
        break;
      }
    }
    if (found == -1) {
      return false;
    }
    for (int y = 0; y < ylim; y++) {
      want[y] ^= g[found][y];
    }
    for (int y = 0; y < ylim; y++) {
      sol[y] ^= id[found][y];
    }
    initx = found + 1;
  }
  return true;
}
bool vans[500000];
vector<pair<int, int> > query[mn];
unsigned long long og[mn][ymax];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  int q;
  scanf("%d%d", &n, &q);
  m = n;
  memset(g, 0, sizeof g);
  memset(og, 0, sizeof og);
  for (int i = 0; i < q; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a;
    --b;
    g[a][b / 64] |= (1ULL << (b % 64));
    og[a][b / 64] |= (1ULL << (b % 64));
    query[b].push_back(make_pair(a, i));
  }
  memset(id, 0, sizeof id);
  for (int x = 0; x < n; x++) {
    id[x][x / 64] |= (1ULL << (x % 64));
  }
  gauss(n, m);
  for (int k = 0; k < n; k++) {
    memset(want, 0, sizeof want);
    want[k / 64] |= (1ULL << (k % 64));
    bool got = solve(n, m);
    assert(got);
    {
      unsigned long long have[ymax];
      memset(have, 0, sizeof have);
      memset(want, 0, sizeof want);
      want[k / 64] |= (1ULL << (k % 64));
      for (int x = 0; x < n; x++) {
        if (sol[x / 64] & (1ULL << (x % 64))) {
          for (int y = 0; y < ymax; y++) {
            have[y] ^= og[x][y];
          }
        }
      }
      for (int y = 0; y < ymax; y++) {
        assert(have[y] == want[y]);
      }
    }
    for (auto &w : query[k]) {
      int a = w.first, idx = w.second;
      if (sol[a / 64] & (1ULL << (a % 64)))
        vans[idx] = false;
      else
        vans[idx] = true;
    }
  }
  for (int i = 0; i < q; i++) {
    if (vans[i])
      printf("YES\n");
    else
      printf("NO\n");
  }
}
