#include <bits/stdc++.h>
using namespace std;
struct interval {
  int l, r;
  int a, b;
  interval(int l, int r, int a, int b) : l(l), r(r), a(a), b(b) {}
};
int n, q, p[100000], size[100000];
bool flip[100000];
bool bad = false;
map<pair<int, int>, int> start;
vector<pair<pair<int, int>, bool>> history;
pair<int, bool> Find(int u) {
  if (p[u] == u) return {p[u], flip[u]};
  auto pa = Find(p[u]);
  if (flip[u]) pa.second = !pa.second;
  return pa;
}
void onion(int a, int b) {
  int ta = Find(a).first, tb = Find(b).first;
  bool ca = Find(a).second, cb = Find(b).second;
  if (ta == tb) {
    history.push_back({{-1, -1}, bad});
    if (ca == cb) bad = true;
  } else {
    if (size[ta] < size[tb]) swap(ta, tb), swap(ca, cb);
    history.push_back({{ta, tb}, bad});
    if (ca == cb) flip[tb] = true;
    p[tb] = ta;
    size[ta] += size[tb];
  }
}
void revert() {
  auto h = history.back();
  history.pop_back();
  bad = h.second;
  if (h.first.first == -1) return;
  int ta = h.first.first, tb = h.first.second;
  p[tb] = tb;
  flip[tb] = 0;
  size[ta] -= size[tb];
}
void daq(int l, int r, vector<interval> &v) {
  int m = (l + r) / 2;
  vector<interval> left, right, all;
  for (interval &in : v) {
    if (in.l <= l && in.r > r)
      all.push_back(in);
    else {
      if (in.l <= m) left.push_back(in);
      if (in.r > m + 1) right.push_back(in);
    }
  }
  for (interval &in : all) onion(in.a, in.b);
  if (l == r) {
    cout << (bad ? "NO\n" : "YES\n");
  } else {
    daq(l, m, left);
    daq(m + 1, r, right);
  }
  for (int i = all.size() - 1; i >= 0; --i) revert();
}
int main() {
  cin >> n >> q;
  for (int i = 0; i < n; ++i) p[i] = i, size[i] = 1;
  vector<interval> intervals;
  for (int i = 0; i < q; ++i) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    if (a > b) swap(a, b);
    if (start.count({a, b})) {
      intervals.push_back(interval(start[{a, b}], i, a, b));
      start.erase({a, b});
    } else
      start[{a, b}] = i;
  }
  for (auto p : start)
    intervals.push_back(interval(p.second, q, p.first.first, p.first.second));
  daq(0, q - 1, intervals);
}
