#include <bits/stdc++.h>
using namespace std;
int n, q;
int x[100100], y[100100];
bool ans[100100];
int par[100100], sz[100100];
int distToPar[100100];
int getpar(int now) { return (par[now] == now) ? now : getpar(par[now]); }
bool getdist(int now) {
  bool ret = (par[now] == now) ? 0 : (getdist(par[now]) ^ distToPar[now]);
  return ret;
}
stack<pair<pair<int, int>, bool> > prevStat;
map<pair<int, int>, int> mp;
vector<pair<pair<int, int>, pair<int, int> > > opSeg;
vector<pair<int, int> > add[400400];
void addSeg(int tl, int tr, pair<int, int> val, int l, int r, int k) {
  if (tl > r || l > tr) return;
  if (tl <= l && r <= tr) {
    add[k].push_back(val);
    return;
  }
  int mid = (l + r) >> 1;
  addSeg(tl, tr, val, l, mid, k + k);
  addSeg(tl, tr, val, mid + 1, r, k + k + 1);
}
bool isBipar = 1;
void addEdge(pair<int, int> now) {
  int u = now.first, v = now.second;
  int pu = getpar(u), pv = getpar(v);
  if (pu == pv) {
    prevStat.push(make_pair(make_pair(-1, -1), isBipar));
    if ((getdist(u) ^ getdist(v)) == 0) {
      isBipar = 0;
    }
    return;
  }
  if (sz[pu] > sz[pv]) swap(u, v), swap(pu, pv);
  prevStat.push(make_pair(make_pair(pu, sz[pu]), isBipar));
  distToPar[pu] = getdist(u) ^ getdist(v) ^ 1;
  par[pu] = pv;
  sz[pv] += sz[pu];
}
void undo() {
  int pos = prevStat.top().first.first, presz = prevStat.top().first.second,
      preIsBipar = prevStat.top().second;
  prevStat.pop();
  if (pos >= 0) {
    sz[pos] = presz;
    sz[par[pos]] -= sz[pos];
    par[pos] = pos;
  }
  isBipar = preIsBipar;
}
void solve(int l, int r, int k) {
  for (int i = 0; i < (int)add[k].size(); i++) {
    addEdge(add[k][i]);
  }
  if (l == r) {
    ans[l] = isBipar;
  } else {
    int mid = (l + r) >> 1;
    solve(l, mid, k + k);
    solve(mid + 1, r, k + k + 1);
  }
  for (int i = 0; i < (int)add[k].size(); i++) undo();
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> q;
  for (int i = 0; i < q; i++) {
    cin >> x[i] >> y[i];
    x[i]--, y[i]--;
    if (x[i] > y[i]) swap(x[i], y[i]);
  }
  for (int i = 0; i < n; i++) par[i] = i, sz[i] = 1;
  for (int i = 0; i < q; i++) {
    pair<int, int> now = make_pair(x[i], y[i]);
    if (!mp.count(now) || mp[now] < 0) {
      mp[now] = i;
    } else {
      opSeg.push_back(make_pair(make_pair(mp[now], i), now));
      mp[now] = -1;
    }
  }
  for (map<pair<int, int>, int>::iterator it = mp.begin(); it != mp.end();
       it++) {
    if (it->second >= 0) {
      opSeg.push_back(make_pair(make_pair(it->second, q), it->first));
    }
  }
  for (int i = 0; i < (int)opSeg.size(); i++) {
    addSeg(opSeg[i].first.first, opSeg[i].first.second - 1, opSeg[i].second, 0,
           q - 1, 1);
  }
  solve(0, q - 1, 1);
  for (int i = 0; i < q; i++) cout << (ans[i] ? "YES" : "NO") << endl;
  return 0;
}
