#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
struct Edge {
  int x, y, s, e;
};
int n, q;
struct dsu {
  int pa[MAXN * 2];
  int sz[MAXN * 2];
  void init(int n) {
    for (int i = 1; i <= n + 1; i++) pa[i] = i;
    for (int i = 1; i <= n + 1; i++) sz[i] = 1;
  }
  int find(int x) { return pa[x] == x ? x : find(pa[x]); }
  bool uni(int p, int q, vector<pair<int, int> > &par1,
           vector<pair<int, int> > &par2) {
    p = find(p);
    q = find(q);
    if (p == q) return 0;
    if (sz[p] < sz[q]) swap(p, q);
    par1.push_back(pair<int, int>(q, pa[q]));
    pa[q] = p;
    if (sz[p] == sz[q]) {
      par2.push_back(pair<int, int>(p, sz[p]));
      sz[p]++;
    }
    return 1;
  }
  void revert(vector<pair<int, int> > &a, vector<pair<int, int> > &b) {
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    for (int i = 0; i < a.size(); i++) pa[a[i].first] = a[i].second;
    for (int i = 0; i < b.size(); i++) sz[b[i].first] = b[i].second;
  }
} dsu;
void solve(int st, int en, vector<Edge> &tol, bool ok) {
  vector<pair<int, int> > par1, par2;
  vector<Edge> l, r;
  int m = (st + en) / 2;
  for (int j = 0; j < tol.size(); j++) {
    Edge i = tol[j];
    if (i.s <= st && en <= i.e) {
      dsu.uni(i.x, i.y + n, par1, par2);
      dsu.uni(i.y, i.x + n, par1, par2);
      if (dsu.find(i.x) == dsu.find(i.x + n)) ok = 0;
    } else {
      if (i.s <= m) l.push_back(i);
      if (i.e > m) r.push_back(i);
    }
  }
  if (st == en) {
    if (ok)
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
    dsu.revert(par1, par2);
    return;
  }
  solve(st, m, l, ok);
  solve(m + 1, en, r, ok);
  dsu.revert(par1, par2);
}
void init() {
  map<pair<int, int>, int> mp;
  vector<Edge> edg;
  cin >> n >> q;
  for (int i = 1; i <= q; i++) {
    int x, y;
    cin >> x >> y;
    if (mp.find(pair<int, int>(x, y)) != mp.end()) {
      int st = mp[pair<int, int>(x, y)];
      int ed = i - 1;
      edg.push_back({x, y, st, ed});
      mp.erase(pair<int, int>(x, y));
    } else {
      mp[pair<int, int>(x, y)] = i;
    }
  }
  for (auto &i : mp)
    edg.push_back({i.first.first, i.first.second, i.second, q});
  dsu.init(2 * n);
  solve(1, q, edg, 1);
}
int main() { init(); }
