#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2, M = 4e5 + 2;
vector<pair<int, int> > s[M];
set<pair<int, int> > lj[N];
set<pair<int, int> >::iterator it;
pair<int, int> st[N], cr;
int f[N], rk[N], len[N], l[M], r[M];
int n, m, q, i, x, y, z, u, v, c, tp;
inline void read(int &x) {
  c = getchar();
  while ((c < 48) || (c > 57)) c = getchar();
  x = c ^ 48;
  c = getchar();
  while ((c >= 48) && (c <= 57)) {
    x = x * 10 + (c ^ 48);
    c = getchar();
  }
}
void build(int x) {
  while (l[x] < r[x]) {
    l[c = x << 1] = l[x];
    r[c] = l[x] + r[x] >> 1;
    l[c | 1] = r[c] + 1;
    r[c | 1] = r[x];
    build(c);
    x = x << 1 | 1;
  }
}
void add(int x) {
  if ((z <= l[x]) && (r[x] <= y)) {
    s[x].push_back(cr);
    return;
  }
  if (z <= r[x << 1]) add(x << 1);
  if (y > r[x << 1]) add(x << 1 | 1);
}
void getf(int &x, int &y) {
  y = 0;
  while (f[x] != x) {
    y ^= len[x];
    x = f[x];
  }
}
inline int uni(int x, int y) {
  getf(x, u);
  getf(y, v);
  if (x != y) {
    if (rk[x] > rk[y]) swap(x, y);
    f[x] = y;
    cr.first = x;
    len[x] = u ^ v ^ 1;
    cr.second = rk[y];
    if (rk[x] == rk[y]) ++rk[y];
    st[++tp] = cr;
    return 0;
  }
  return (u ^ v ^ 1);
}
inline void del(pair<int, int> &x) {
  rk[f[x.first]] = x.second;
  f[x.first] = x.first;
}
void sum(int x) {
  int cur = tp;
  for (i = 0; i < s[x].size(); i++)
    if (uni(s[x][i].first, s[x][i].second)) {
      while (tp > cur) del(st[tp--]);
      for (i = l[x]; i <= r[x]; i++) puts("NO");
      return;
    }
  if (l[x] == r[x]) {
    puts("YES");
    while (tp > cur) del(st[tp--]);
    return;
  }
  sum(x << 1);
  sum(x << 1 | 1);
  while (tp > cur) del(st[tp--]);
}
int main() {
  read(n);
  read(q);
  m = n << 1;
  r[l[1] = 1] = q;
  build(1);
  for (i = 1; i <= n; i++) f[i] = i;
  for (i = 1; i <= q; i++) {
    read(u);
    read(v);
    if (u > v) swap(u, v);
    cr.first = v;
    cr.second = 0;
    it = lj[u].lower_bound(cr);
    if ((it == lj[u].end()) || ((*it).first != v)) {
      cr.second = i;
      lj[u].insert(cr);
    } else {
      z = (*it).second;
      y = i - 1;
      lj[u].erase(it);
      cr.first = u;
      cr.second = v;
      add(1);
    }
  }
  for (i = 1; i <= n; i++)
    for (it = lj[i].begin(); it != lj[i].end(); it++) {
      cr.first = i;
      cr.second = (*it).first;
      z = (*it).second;
      y = q;
      add(1);
    }
  sum(1);
}
