#include <bits/stdc++.h>
using namespace std;
template <class I>
bool chmax(I& a, I b) {
  return a < b ? (a = b, true) : false;
}
template <class I>
bool chmin(I& a, I b) {
  return b < a ? (a = b, true) : false;
}
#pragma GCC optimize("Ofast")
vector<bool> ans;
struct UDS {
  vector<int> s, f;
  vector<pair<int, int>> rec;
  void init(int n) {
    s.assign(n + 1, 1);
    f.resize(n + 1);
    iota(begin(f), end(f), 0);
  }
  int F(int a) {
    while (f[a] != a) a = f[a];
    return a;
  }
  bool M(int a, int b) {
    a = F(a), b = F(b);
    if (a == b) return false;
    if (s[a] < s[b]) swap(a, b);
    rec.emplace_back(a, b);
    f[b] = a, s[a] += s[b];
    return true;
  }
  void U() {
    assert(rec.size() > 0);
    auto [a, b] = rec.back();
    rec.pop_back();
    s[a] -= s[b], f[b] = b;
  }
};
struct BPT {
  UDS uds;
  int n, cnt;
  void init(int nn) {
    n = nn;
    uds.init(n * 2);
    cnt = 0;
  }
  int M(int a, int b) {
    ((void)0);
    bool x = uds.M(a, b + n);
    bool y = uds.M(a + n, b);
    bool nb = (uds.F(a) == uds.F(a + n));
    if (x and (cnt != 0 or nb)) ++cnt;
    if (y and (cnt != 0 or nb)) ++cnt;
    return int(x + y);
  }
  bool A() { return cnt == 0; }
  void U() {
    uds.U();
    if (cnt > 0) --cnt;
  }
} bpt;
struct SGT {
  int n;
  vector<vector<pair<int, int>>> val;
  constexpr int id(int l, int r) const { return (l + r) | (l != r); }
  void init(int nn) {
    n = nn;
    val.resize((n + 1) * 2);
  }
  void ins(int l, int r, int ql, int qr, pair<int, int> e) {
    if (ql <= l and r <= qr) {
      val[id(l, r)].emplace_back(e);
      ((void)0);
      return;
    }
    int m = (l + r) / 2;
    if (ql <= m) ins(l, m, ql, qr, e);
    if (m < qr) ins(m + 1, r, ql, qr, e);
  }
  void ins(int ql, int qr, pair<int, int> e) { ins(0, n, ql, qr, e); }
  void dfs(int l, int r) {
    int cnt = 0;
    for (auto [u, v] : val[id(l, r)]) cnt += bpt.M(u, v);
    if (l == r)
      ans[l] = bpt.A();
    else {
      int m = (l + r) / 2;
      dfs(l, m);
      dfs(m + 1, r);
    }
    for (; cnt; --cnt) bpt.U();
  }
  void dfs() { dfs(0, n); }
} sgt;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  map<pair<int, int>, int> mp;
  vector<tuple<int, int, int, int>> es;
  for (int u, v, i = 1; i <= q; ++i) {
    cin >> u >> v;
    if (mp.count(pair<int, int>(u, v))) {
      es.emplace_back(u, v, mp[pair<int, int>(u, v)], i - 1);
      mp.erase(pair<int, int>(u, v));
    } else
      mp[pair<int, int>(u, v)] = i;
  }
  for (auto [e, t] : mp) es.emplace_back(e.first, e.second, t, q);
  sgt.init(q);
  bpt.init(n);
  ans.resize(q + 1);
  for (auto [u, v, l, r] : es) sgt.ins(l, r, pair<int, int>(u, v));
  sgt.dfs();
  for (int i = 1; i <= q; ++i) cout << (ans[i] ? "YES\n" : "NO\n");
  return 0;
}
