#include <bits/stdc++.h>
using namespace std;
const int maxn = 110000;
int n, q;
map<pair<int, int>, int> M;
int u[maxn], v[maxn];
int s[maxn], e[maxn];
vector<int> V[maxn << 4];
struct DSU {
  int fa[maxn], col[maxn], sz[maxn];
  stack<pair<pair<int *, int>, int>> stk;
  int findfa(int x, int &val) {
    val ^= col[x];
    return x == fa[x] ? x : findfa(fa[x], val);
  }
  void init() {
    for (int i = 1; i <= n; i++) fa[i] = i, col[i] = 0, sz[i] = 1;
  }
  bool dsunion(int x, int y, int t) {
    int cx = 0, cy = 0;
    int fx = findfa(x, cx), fy = findfa(y, cy);
    if (fx == fy) return cx ^ cy;
    if (sz[fx] > sz[fy]) swap(fx, fy);
    stk.push({{&fa[fx], fa[fx]}, t});
    fa[fx] = fy;
    stk.push({{&sz[fy], sz[fy]}, t});
    sz[fy] += sz[fx];
    stk.push({{&col[fx], col[fx]}, t});
    col[fx] = cx ^ cy ^ 1;
    return 1;
  }
  void goback(int t) {
    while (!stk.empty()) {
      if (stk.top().second != t) break;
      (*stk.top().first.first) = stk.top().first.second;
      stk.pop();
    }
  }
} dsu;
void Add(int L, int R, int val, int l, int r, int rt) {
  if (L <= l && R >= r) {
    V[rt].push_back(val);
    return;
  }
  int m = (l + r) >> 1;
  if (L <= m) Add(L, R, val, l, m, rt << 1);
  if (R > m) Add(L, R, val, m + 1, r, rt << 1 | 1);
}
void solve(int l, int r, int rt) {
  for (int i = 0; i < V[rt].size(); i++) {
    int _ = V[rt][i];
    if (!dsu.dsunion(u[_], v[_], rt)) {
      for (int j = l; j <= r; j++) puts("NO");
      dsu.goback(rt);
      return;
    }
  }
  if (l == r)
    puts("YES");
  else {
    int m = (l + r) >> 1;
    solve(l, m, rt << 1);
    solve(m + 1, r, rt << 1 | 1);
  }
  dsu.goback(rt);
}
int main() {
  int cnt = 0;
  scanf("%d%d", &n, &q);
  dsu.init();
  for (int i = 1; i <= q; i++) {
    int uu, vv;
    scanf("%d%d", &uu, &vv);
    if (!M.count({uu, vv})) {
      ++cnt;
      u[cnt] = uu, v[cnt] = vv;
      M[{uu, vv}] = cnt;
      s[cnt] = i;
    } else {
      e[M[{uu, vv}]] = i - 1;
      M.erase({uu, vv});
    }
  }
  for (auto it = M.begin(); it != M.end(); it++) e[it->second] = q;
  for (int i = 1; i <= cnt; i++) Add(s[i], e[i], i, 1, q, 1);
  solve(1, q, 1);
  return 0;
}
