#include <bits/stdc++.h>
using namespace std;
int n, m, rp[100010], u[100010], v[100010];
map<pair<int, int>, int> s;
vector<int> g[400010];
void upd(int p, int l, int r, int x, int y, int z) {
  if (x <= l && r <= y) {
    g[p].push_back(z);
    return;
  }
  if (y < l || x > r) return;
  int mid = (l + r) >> 1;
  upd(p << 1, l, mid, x, y, z);
  upd(p << 1 | 1, mid + 1, r, x, y, z);
}
int f[200010], sz[200010];
bool ans[100010];
int find(int x) {
  if (x == f[x]) return x;
  return find(f[x]);
}
int top, up[4000010], vp[4000010], us[4000010];
bool merge(int u, int v) {
  u = find(u);
  v = find(v);
  if (u == v) return 1;
  if (sz[u] < sz[v]) swap(u, v);
  up[++top] = u, vp[top] = v, us[top] = sz[u];
  sz[u] += sz[v];
  f[v] = u;
  return 0;
}
bool check(int u, int v) { return find(u) == find(v); }
void solve(int p, int l, int r, int fl) {
  int ntop = top;
  bool anss = fl;
  for (int i = 0; i < g[p].size(); i++)
    anss |= check(u[g[p][i]], v[g[p][i]]),
        anss |= check(u[g[p][i]] + n, v[g[p][i]] + n),
        merge(u[g[p][i]] + n, v[g[p][i]]), merge(u[g[p][i]], v[g[p][i]] + n);
  if (l == r) {
    ans[l] = anss;
    return;
  }
  int mid = (l + r) >> 1;
  solve(p << 1, l, mid, anss);
  solve(p << 1 | 1, mid + 1, r, anss);
  while (top > ntop) sz[up[top]] = us[top], f[vp[top]] = vp[top], top--;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= 2 * n; i++) f[i] = i, sz[i] = 1;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &u[i], &v[i]);
    if (u[i] > v[i]) swap(u[i], v[i]);
    int x = s[make_pair(u[i], v[i])];
    if (x)
      rp[x] = i - 1, rp[i] = -1, s[make_pair(u[i], v[i])] = 0;
    else
      s[make_pair(u[i], v[i])] = i;
  }
  for (int i = 1; i <= m; i++)
    if (rp[i] != -1) {
      if (!rp[i]) rp[i] = m;
      upd(1, 1, m, i, rp[i], i);
    }
  solve(1, 1, m, 0);
  for (int i = 1; i <= m; i++) puts(ans[i] ? "NO" : "YES");
  return 0;
}
