#include <bits/stdc++.h>
using namespace std;
int n, m, t, fa[500005], top, q[500005 << 2], d[500005], a[500005];
struct Edge {
  int x, y, l, r;
} G[500005];
inline int get(int x) {
  while (fa[x] != x) x = fa[x];
  return x;
}
inline int dis(int x) {
  int ret = 0;
  while (fa[x] != x) ret ^= a[x], x = fa[x];
  return ret;
}
inline void link(int x, int y, int v) {
  if (d[x] > d[y]) swap(x, y);
  if (d[x] == d[y]) d[y]++, q[++top] = y;
  fa[x] = y;
  a[x] = v;
  q[++top] = x;
}
inline void erase(int x) {
  for (; top > x; top--)
    if (q[top < 0])
      d[-q[top]]--;
    else
      fa[q[top]] = q[top], a[q[top]] = 0;
}
void solve(int l, int r, int k) {
  int mid = (l + r) >> 1, now = top;
  for (int i = 1; i <= k; i++)
    if (G[i].l <= l && r <= G[i].r) {
      int u = get(G[i].x), v = get(G[i].y);
      if (u != v)
        link(u, v, dis(G[i].x) == dis(G[i].y));
      else if (dis(G[i].x) == dis(G[i].y)) {
        for (int i = l; i <= r; i++) puts("NO");
        erase(now);
        return;
      }
      swap(G[k--], G[i--]);
    }
  if (l == r)
    puts("YES");
  else {
    int i, j;
    for (i = 1, j = 0; i <= k; i++)
      if (G[i].l <= mid) swap(G[i], G[++j]);
    solve(l, mid, j);
    for (i = 1, j = 0; i <= k; i++)
      if (G[i].r > mid) swap(G[i], G[++j]);
    solve(mid + 1, r, j);
  }
  erase(now);
}
map<int, int> mp[500005];
inline int read() {
  int f = 1, x = 0;
  char ch;
  do {
    ch = getchar();
    if (ch == '-') f = -1;
  } while (ch < '0' || ch > '9');
  do {
    x = x * 10 + ch - '0';
    ch = getchar();
  } while (ch >= '0' && ch <= '9');
  return f * x;
}
int main() {
  n = read();
  t = read();
  for (int i = 1; i <= t; i++) {
    int x = read(), y = read();
    if (x > y) swap(x, y);
    if (mp[x][y])
      G[mp[x][y]].r = i - 1, mp[x][y] = 0;
    else {
      mp[x][y] = ++m;
      G[m].x = x;
      G[m].y = y;
      G[m].l = i - 1;
      G[m].r = t;
    }
  }
  for (int i = 1; i <= m; i++) ++G[i].l;
  for (int i = 1; i <= n; i++) fa[i] = i, d[i] = 1;
  solve(1, t, m);
}
