#include <bits/stdc++.h>
using namespace std;
struct node {
  int u, v, l, r;
} que[105000];
map<pair<int, int>, int> mp;
int n, q;
int fa[105000];
int val[105000];
int dep[105000];
int tot, cnt;
int save[105000 << 1];
int getfa(int x) {
  if (x == fa[x]) return x;
  return getfa(fa[x]);
}
int getval(int x) {
  int ans = 0;
  while (x != fa[x]) {
    ans ^= val[x];
    x = fa[x];
  }
  return ans;
}
void undo(int tag) {
  while (cnt != tag) {
    if (save[cnt] < 0) {
      dep[-save[cnt--]]--;
    } else {
      fa[save[cnt]] = save[cnt];
      val[save[cnt]] = 0;
      cnt--;
    }
  }
}
void unio(int u, int v, int Val) {
  if (dep[u] > dep[v]) swap(u, v);
  if (dep[u] == dep[v]) {
    dep[v]++;
    save[++cnt] = -v;
  }
  fa[u] = v;
  val[u] = Val;
  save[++cnt] = u;
}
void solve(int L, int R, int num) {
  int tag = cnt;
  for (int i = 1; i <= num; i++) {
    if (que[i].l <= L && que[i].r >= R) {
      int fu = getfa(que[i].u), fv = getfa(que[i].v);
      int valu = getval(que[i].u), valv = getval(que[i].v);
      if (fu == fv && (valu ^ valv) == 0) {
        for (int i = L; i <= R; i++) printf("NO\n");
        undo(tag);
        return;
      }
      unio(fu, fv, valu ^ valv ^ 1);
      swap(que[i--], que[num--]);
    }
  }
  if (L == R) {
    printf("YES\n");
    undo(tag);
    return;
  }
  int mid = (L + R) / 2;
  int pnum = num;
  for (int i = 1; i <= pnum; i++) {
    if (que[i].l > mid) swap(que[i--], que[pnum--]);
  }
  solve(L, mid, pnum);
  pnum = num;
  for (int i = 1; i <= pnum; i++) {
    if (que[i].r <= mid) swap(que[i--], que[pnum--]);
  }
  solve(mid + 1, R, pnum);
  undo(tag);
}
int main() {
  cin >> n >> q;
  for (int i = 1; i <= q; i++) {
    int x, y;
    cin >> x >> y;
    if (mp.find(make_pair(x, y)) == mp.end()) {
      que[++tot] = (node){x, y, i, q};
      mp[make_pair(x, y)] = tot;
    } else {
      que[mp[make_pair(x, y)]].r = i - 1;
      mp.erase(mp.find(make_pair(x, y)));
    }
  }
  for (int i = 1; i <= n; i++) fa[i] = i;
  solve(1, q, tot);
}
