#include <bits/stdc++.h>
using namespace std;
const int M = 100005;
int read() {
  int x = 0, flag = 1;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag = -1;
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x * flag;
}
int n, m, tp, dep[M], c[M], fa[M], st[2 * M];
map<pair<int, int>, int> mp;
vector<pair<int, int> > v[4 * M];
int find(int x) { return x == fa[x] ? x : find(fa[x]); }
int dis(int x) { return x == fa[x] ? 0 : (c[x] ^ dis(fa[x])); }
void merge(int u, int v, int ct) {
  if (dep[u] < dep[v]) swap(u, v);
  fa[v] = u;
  c[v] = ct;
  if (dep[u] == dep[v]) st[++tp] = -u, dep[u]++;
  st[++tp] = v;
}
void back(int t) {
  while (tp > t) {
    if (st[tp] < 0)
      dep[-st[tp]]--;
    else
      fa[st[tp]] = st[tp], c[st[tp]] = 0;
    tp--;
  }
}
void ins(int i, int l, int r, int L, int R, pair<int, int> x) {
  if (l > R || L > r) return;
  if (L <= l && r <= R) {
    v[i].push_back(x);
    return;
  }
  int mid = (l + r) >> 1;
  ins(i << 1, l, mid, L, R, x);
  ins(i << 1 | 1, mid + 1, r, L, R, x);
}
void ask(int i, int l, int r) {
  int cur = tp;
  for (int j = 0; j < v[i].size(); j++) {
    int x = v[i][j].first, y = v[i][j].second;
    int flag = dis(x) ^ dis(y) ^ 1;
    if (find(x) == find(y)) {
      if (flag) {
        for (int i = l; i <= r; i++) puts("NO");
        back(cur);
        return;
      }
    } else
      merge(find(x), find(y), flag);
  }
  if (l == r) {
    puts("YES");
    back(cur);
    return;
  }
  int mid = (l + r) >> 1;
  ask(i << 1, l, mid);
  ask(i << 1 | 1, mid + 1, r);
  back(cur);
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read();
    pair<int, int> t = make_pair(u, v);
    if (mp.count(t))
      ins(1, 1, m, mp[t], i - 1, t), mp.erase(t);
    else
      mp[t] = i;
  }
  for (map<pair<int, int>, int>::iterator it = mp.begin(); it != mp.end(); it++)
    ins(1, 1, m, it->second, m, it->first);
  ask(1, 1, m);
}
