#include <bits/stdc++.h>
using namespace std;
struct Dsu {
  int par, sz;
  bool clr;
};
int n, q, ans;
Dsu a[((int)101 * 1000)];
map<pair<int, int>, int> mp;
vector<pair<int, int> > seg[4 * ((int)101 * 1000)];
pair<int, int> root(int x) {
  if (a[x].par < 0) return {x, 0};
  pair<int, int> res = root(a[x].par);
  res.second ^= a[x].clr;
  return res;
}
void update(int ql, int qr, pair<int, int> ed, int xl = 0, int xr = q,
            int id = 1) {
  if (qr <= xl || xr <= ql) return;
  if (ql <= xl && xr <= qr) {
    seg[id].push_back(ed);
    return;
  }
  int mid = (xl + xr) / 2;
  update(ql, qr, ed, xl, mid, id * 2);
  update(ql, qr, ed, mid, xr, id * 2 + 1);
}
void build(int xl = 0, int xr = q, int id = 1) {
  int mid = (xl + xr) / 2;
  int now = 0;
  vector<pair<int, int> > ex;
  for (auto u : seg[id]) {
    pair<int, int> r1, r2;
    r1 = root(u.first);
    r2 = root(u.second);
    if (r1.first == r2.first) {
      if (r1.second == r2.second) now++;
      continue;
    }
    if (a[r1.first].sz > a[r2.first].sz) swap(r1, r2), swap(u.first, u.second);
    ex.push_back({r1.first, r2.first});
    if (r1.second == r2.second) a[r1.first].clr = 1;
    a[r2.first].sz += a[r1.first].sz;
    a[r1.first].par = r2.first;
  }
  ans += now;
  if (xl == xr - 1) {
    cout << ((!ans) ? "YES\n" : "NO\n");
  } else {
    build(xl, mid, id * 2);
    build(mid, xr, id * 2 + 1);
  }
  ans -= now;
  for (int i = (int)ex.size() - 1; i >= 0; i--) {
    pair<int, int> u = ex[i];
    a[u.second].sz -= a[u.first].sz;
    a[u.first].par = -1;
    a[u.first].clr = 0;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) a[i].par = -1, a[i].clr = 0, a[i].sz = 1;
  for (int i = 0; i < q; i++) {
    int v, u;
    cin >> v >> u;
    if (v > u) swap(v, u);
    if (mp[{v, u}])
      update(mp[{v, u}] - 1, i, {v, u}), mp[{v, u}] = 0;
    else
      mp[{v, u}] = i + 1;
  }
  for (auto u : mp)
    if (u.second) update(u.second - 1, q, u.first);
  build();
  return 0;
}
