#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
int n, q, m, fa[maxn], d[maxn], a[maxn], st[maxn << 1], top;
map<int, int> mp[maxn];
struct edge {
  int x, y, l, r;
};
edge e[maxn];
int Getfa(int x) {
  int ret = x;
  while (fa[ret] != ret) ret = fa[ret];
  return ret;
}
int col(int x) {
  int now = 0;
  while (x != fa[x]) now ^= a[x], x = fa[x];
  return now;
}
void link(int x, int y, int D) {
  if (d[x] > d[y]) swap(x, y);
  if (d[x] == d[y]) d[y]++, st[++top] = -y;
  fa[x] = y;
  a[x] = D;
  st[++top] = x;
}
void re(int t) {
  for (; t < top; top--) {
    if (st[top] < 0)
      d[-st[top]]--;
    else
      fa[st[top]] = st[top], a[st[top]] = 0;
  }
}
void work(int l, int r, int k) {
  int now = top;
  for (int i = 1; i <= k; i++)
    if (e[i].l <= l && e[i].r >= r) {
      int u = Getfa(e[i].x), v = Getfa(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 j = l; j <= r; j++) puts("NO");
        re(now);
        return;
      }
      swap(e[i], e[k--]);
      i--;
    }
  if (l == r)
    puts("YES");
  else {
    int mid = l + (r - l) / 2;
    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);
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= q; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (mp[l][r])
      e[mp[l][r]].r = i - 1, mp[l][r] = 0;
    else {
      mp[l][r] = ++m;
      e[m].l = i;
      e[m].x = l;
      e[m].y = r;
      e[m].r = q;
    }
  }
  for (int i = 1; i <= n; i++) fa[i] = i, d[i] = 1;
  work(1, q, m);
  return 0;
}
