#include <bits/stdc++.h>
using namespace std;
struct edge {
  int u, v;
};
struct Node {
  int x, y, fa, r, d;
};
const int N = 1e5 + 10;
struct rollbackDSU {
  int p[N], rankk[N], dist[N];
  stack<Node> st;
  void init(int n) {
    for (int i = 1; i <= n; i++) p[i] = i, rankk[i] = 0, dist[i] = 0;
  }
  int find(int x) {
    while (x != p[x]) x = p[x];
    return x;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int getdist(int x) {
    int d = 0;
    while (x != p[x]) d ^= dist[x], x = p[x];
    return d;
  }
  void unite(int x, int y) {
    int fx = find(x), fy = find(y);
    if (rankk[fx] > rankk[fy]) swap(fx, fy);
    st.push({fx, fy, p[fx], rankk[fy], dist[fx]});
    if (rankk[fx] == rankk[fy]) rankk[fy]++;
    dist[fx] = getdist(x) ^ getdist(y) ^ 1;
    p[fx] = fy;
  }
  void rollback(int x) {
    for (int i = 1; i <= x; i++) {
      Node y = st.top();
      st.pop();
      p[y.x] = y.fa;
      rankk[y.y] = y.r;
      dist[y.x] = y.d;
    }
  }
};
edge E[N];
vector<int> rec[N << 2];
int st[N], ans[N];
rollbackDSU dsu;
map<pair<int, int>, int> sav;
void update(int ql, int qr, int id, int rt, int l, int r) {
  if (ql <= l && r <= qr) {
    rec[rt].push_back(id);
    return;
  }
  int mid = (l + r) >> 1;
  if (ql <= mid) update(ql, qr, id, rt << 1, l, mid);
  if (qr > mid) update(ql, qr, id, rt << 1 | 1, mid + 1, r);
}
void dfs(int rt, int l, int r) {
  int sz = (int)rec[rt].size(), flag = 1, id, cnt = 0, u, v;
  for (int i = 0; i < sz; i++) {
    id = rec[rt][i];
    u = E[id].u;
    v = E[id].v;
    if (dsu.same(u, v)) {
      if ((dsu.getdist(u) ^ dsu.getdist(v)) == 0) flag = 0;
    } else {
      dsu.unite(u, v);
      cnt++;
    }
  }
  if (!flag) {
    for (int i = l; i <= r; i++) ans[i] = 0;
  } else if (l == r)
    ans[l] = 1;
  else {
    int mid = (l + r) >> 1;
    dfs(rt << 1, l, mid);
    dfs(rt << 1 | 1, mid + 1, r);
  }
  dsu.rollback(cnt);
}
int main() {
  int n, q, tot, u, v;
  scanf("%d %d", &n, &q);
  dsu.init(n);
  tot = 0;
  for (int i = 1; i <= q; i++) {
    scanf("%d %d", &u, &v);
    if (sav.count({u, v})) {
      E[++tot] = (edge){u, v};
      update(sav[{u, v}], i - 1, tot, 1, 1, q);
      sav.erase({u, v});
    } else
      sav[{u, v}] = i;
  }
  for (auto it : sav) {
    E[++tot] = (edge){it.first.first, it.first.second};
    update(it.second, q, tot, 1, 1, q);
  }
  dfs(1, 1, q);
  for (int i = 1; i <= q; i++) {
    if (ans[i])
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
