#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 5e5 + 10;
struct Edge {
  int x, y, l, r;
} e[N];
int a[N], fa[N];
int st[N << 2], top;
int find(int x) {
  while (fa[x] != x) x = fa[x];
  return x;
}
int col(int x) {
  int now = 0;
  while (fa[x] != x) now ^= a[x], x = fa[x];
  return now;
}
void link(int x, int y, int t) { fa[x] = y, a[x] = t, st[++top] = x; }
void re(int t) {
  while (top > t) {
    fa[st[top]] = st[top], a[st[top]] = 0;
    top--;
  }
}
void work(int l, int r, int k) {
  int mid = (l + r >> 1), now = top;
  for (int i = 1; i <= k; i++)
    if (e[i].l <= l && r <= e[i].r) {
      int u = find(e[i].x), v = find(e[i].y);
      if (u != v)
        link(u, v, col(e[i].x) == col(e[i].y));
      else if (col(e[i].x) == col(e[i].y)) {
        for (int i = l; i <= r; i++) cout << "NO" << '\n';
        re(now);
        return;
      }
      swap(e[k--], e[i--]);
    }
  if (l == r)
    cout << "YES" << '\n';
  else {
    int i, j;
    for (i = 1, j = 0; i <= k; i++)
      if (e[i].l <= mid) swap(e[i], e[++j]);
    work(l, mid, j);
    for (i = 1, j = 0; i <= k; i++)
      if (e[i].r > mid) swap(e[i], e[++j]);
    work(mid + 1, r, j);
  }
  re(now);
}
map<int, int> mp[N];
int main() {
  std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, _, m = 0;
  cin >> n >> _;
  for (int i = 1; i <= _; i++) {
    int x, y;
    cin >> x >> y;
    if (y < x) swap(x, y);
    if (mp[x][y])
      e[mp[x][y]].r = i - 1, mp[x][y] = 0;
    else {
      mp[x][y] = ++m;
      e[m].x = x;
      e[m].y = y;
      e[m].l = i;
      e[m].r = _;
    }
  }
  for (int i = 1; i <= n; i++) fa[i] = i;
  work(1, _, m);
  return 0;
}
