#include <bits/stdc++.h>
using namespace std;
struct Dsu {
  struct node_struct {
    int par, size;
    node_struct(int p, int s) : par(p), size(s) {}
    void merge(node_struct &b) {
      b.par = par;
      size += b.size;
    }
  };
  int n;
  vector<node_struct> nodes;
  stack<tuple<int, int, node_struct, node_struct>> stk;
  int bipartiteTop;
  Dsu(int n) : n(n), bipartiteTop(0) {
    nodes.reserve(n);
    for (int i = 0; i < n; ++i) nodes.emplace_back(i, 1);
  }
  int anc(int x) {
    while (x != nodes[x].par) x = nodes[x].par;
    return x;
  }
  int emy(int x) { return x >= n / 2 ? x - n / 2 : x + n / 2; }
  bool unite(int x, int y) {
    int a = anc(x);
    int b = anc(y);
    bipartiteTop += isBiparitie() and a != anc(emy(x)) and b != anc(emy(y));
    stk.emplace(a, b, nodes[a], nodes[b]);
    if (a == b) return false;
    if (nodes[a].size < nodes[b].size) swap(a, b);
    nodes[a].merge(nodes[b]);
    return true;
  }
  void revert(int version = -1) {
    if (version == -1) version = stk.size() - 1;
    for (; stk.size() != version; stk.pop()) {
      nodes[get<0>(stk.top())] = get<2>(stk.top());
      nodes[get<1>(stk.top())] = get<3>(stk.top());
      bipartiteTop = min(bipartiteTop, int(stk.size()) - 1);
    }
  }
  bool isBiparitie() { return bipartiteTop == stk.size(); }
};
class Seg {
  int l, m, r;
  Seg *ch[2];

 public:
  vector<pair<int, int>> Es;
  Seg(int l, int r) : l(l), m(l + r >> 1), r(r) {
    if (r - l > 1) {
      ch[0] = new Seg(l, m);
      ch[1] = new Seg(m, r);
    }
  }
  void add_tag(int ql, int qr, pair<int, int> e) {
    if (ql <= l and r <= qr)
      Es.push_back(e);
    else {
      if (ql < m) ch[0]->add_tag(ql, qr, e);
      if (m < qr) ch[1]->add_tag(ql, qr, e);
    }
  }
  void dfs(Dsu &D, int n) {
    for (pair<int, int> e : Es) {
      int x, y;
      tie(x, y) = e;
      D.unite(x, y + n);
      D.unite(y, x + n);
    }
    if (r - l == 1)
      cout << (D.isBiparitie() ? "YES" : "NO") << '\n';
    else {
      ch[0]->dfs(D, n);
      ch[1]->dfs(D, n);
    }
    while (Es.size()) Es.pop_back(), D.revert(), D.revert();
  }
};
class Solution {
  int n, q;

 public:
  void run() {
    cin >> n >> q;
    Dsu djs(2 * n);
    Seg tree(0, q);
    map<pair<int, int>, int> addTime;
    for (int i = 0; i < q; ++i) {
      int u, v;
      cin >> u >> v;
      --u, --v;
      pair<int, int> e{u, v};
      if (addTime.count(e)) {
        tree.add_tag(addTime[e], i, e);
        addTime.erase(e);
      } else {
        addTime[e] = i;
      }
    }
    for (auto P : addTime) {
      pair<int, int> e;
      int t;
      tie(e, t) = P;
      tree.add_tag(t, q, e);
    }
    tree.dfs(djs, n);
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin.tie(0);
  Solution().run();
  return 0;
}
