#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 5;
map<int, int> mp[N];
int n, q;
long long odd[N], ev[N];
int x[N], y[N];
int fa[N], w[N], rk[N];
vector<pair<long long, int> > st[N << 2];
int ans[N];
struct node {
  int x, y, rk;
  node(int _x, int _y, int _r) { x = _x, y = _y, rk = _r; }
};
vector<node> p[N << 2];
int get(int x) {
  if (x == fa[x]) return 0;
  return get(fa[x]) ^ w[x];
}
int F(int x) {
  if (x == fa[x]) return x;
  return F(fa[x]);
}
bool un(int x, int y, int rt) {
  int fx = F(x), fy = F(y);
  if (rk[fx] > rk[fy]) swap(fx, fy);
  if (fx == fy) {
    if (get(x) == get(y)) return true;
    return false;
  }
  p[rt].push_back(node(fx, fy, rk[fy]));
  w[fx] = (get(x) ^ get(y) ^ 1);
  if (rk[fx] == rk[fy]) rk[fy]++;
  fa[fx] = fy;
  return false;
}
void upd(int L, int R, pair<long long, int> e, int l, int r, int rt) {
  if (L <= l && r <= R) {
    st[rt].push_back(e);
    return;
  }
  int m = (l + r) / 2;
  if (L <= m) upd(L, R, e, l, m, rt << 1);
  if (R > m) upd(L, R, e, m + 1, r, rt << 1 | 1);
}
bool gao(int rt) {
  for (auto it : st[rt]) {
    if (un(it.first, it.second, rt)) return true;
  }
  return false;
}
void undo(int rt) {
  reverse(p[rt].begin(), p[rt].end());
  for (auto it : p[rt]) {
    fa[it.x] = it.x;
    w[it.x] = 0;
    rk[it.y] = it.rk;
  }
}
void solve(int l, int r, int rt) {
  if (gao(rt)) {
    for (int i = (l); i < (r + 1); i++) ans[i] = 1;
    undo(rt);
    return;
  }
  if (l == r) {
    undo(rt);
    return;
  }
  int m = (l + r) / 2;
  solve(l, m, rt << 1);
  solve(m + 1, r, rt << 1 | 1);
  undo(rt);
}
int main() {
  cin >> n >> q;
  for (int i = (1); i < (n + 1); i++) fa[i] = i, w[i] = 0, rk[i] = 1;
  int u, v;
  for (int i = (1); i < (q + 1); i++) {
    cin >> x[i] >> y[i];
    if (mp[x[i]][y[i]]) {
      upd(mp[x[i]][y[i]], i - 1, pair<long long, int>(x[i], y[i]), 1, q, 1);
      mp[x[i]][y[i]] = 0;
    } else {
      mp[x[i]][y[i]] = i;
    }
  }
  for (int i = (1); i < (q + 1); i++) {
    if (mp[x[i]][y[i]]) {
      upd(mp[x[i]][y[i]], q, pair<long long, int>(x[i], y[i]), 1, q, 1);
      mp[x[i]][y[i]] = 0;
    }
  }
  solve(1, q, 1);
  for (int i = (1); i < (q + 1); i++)
    if (!ans[i])
      cout << "YES\n";
    else
      cout << "NO\n";
  return 0;
}
