#include <bits/stdc++.h>
using namespace std;
const int ms = 1e5 + 5;
int n, q;
vector<int> sz, changes;
vector<pair<int, int> > ds;
void init() {
  sz.resize(n, 1);
  ds.resize(n);
  for (int i = 0; i < n; ++i) ds[i] = {i, 0};
}
pair<int, int> find(int a) {
  if (ds[a].first != a) {
    auto u = find(ds[a].first);
    return {u.first, ds[a].second ^ u.second};
  }
  return ds[a];
}
bool join(int a, int b) {
  pair<int, int> x = find(a);
  pair<int, int> y = find(b);
  if (x.first == y.first) return x.second ^ y.second;
  if (sz[y.first] > sz[x.first]) swap(x, y);
  sz[x.first] += sz[y.first];
  ds[y.first] = {x.first, y.second ^ x.second ^ 1};
  changes.push_back(y.first);
  return true;
}
void rollback(int t) {
  while (changes.size() > t) {
    int u = changes.back();
    sz[find(u).first] -= sz[u];
    ds[u] = {u, 0};
    changes.pop_back();
  }
}
struct Query {
  int tin, tout, u, v;
  Query(int tin = 0, int tout = 0, int u = 0, int v = 0)
      : tin(tin), tout(tout), u(u), v(v) {}
};
vector<Query> qry;
vector<bool> ans;
void solve(int l, int r, vector<Query> &nw, bool good = true) {
  vector<Query> nx;
  for (auto curr : nw) {
    if (curr.tin > r || curr.tout < l) continue;
    if (curr.tin <= l && curr.tout >= r) {
      good = good & join(curr.u, curr.v);
      continue;
    }
    nx.push_back(curr);
  }
  if (l == r) {
    ans[l] = good;
    return;
  }
  int now = changes.size();
  int mid = (l + r) / 2;
  solve(l, mid, nx, good);
  rollback(now);
  solve(mid + 1, r, nx, good);
  rollback(now);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> q;
  ans.resize(q, false);
  init();
  map<pair<int, int>, int> mp;
  for (int i = 0; i < q; ++i) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    if (u > v) swap(u, v);
    if (mp.count({u, v})) {
      qry.emplace_back(mp[{u, v}], i - 1, u, v);
      mp.erase({u, v});
    } else {
      mp[{u, v}] = i;
    }
  }
  for (auto x : mp) {
    qry.emplace_back(x.second, q - 1, x.first.first, x.first.second);
  }
  solve(0, q - 1, qry);
  for (int i = 0; i < q; ++i) {
    if (ans[i])
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
