#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const long long mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, q;
int p[N];
int s[N];
int f[N];
int ans[N];
map<int, int> m[N];
vector<pair<int, int> > t[4 * N];
vector<pair<int*, int> > bl;
int get(int x) { return (p[x] == x ? x : get(p[x])); }
int get_c(int x) { return (p[x] == x ? 0 : (f[x] ^ get_c(p[x]))); }
void upd(int x, int l, int r, int tl, int tr, int val1, int val2) {
  if (tl > tr) return;
  if (l == tl && r == tr) {
    t[x].push_back({val1, val2});
    return;
  }
  int m = (l + r) / 2;
  upd(x + x, l, m, tl, min(tr, m), val1, val2);
  upd(x + x + 1, m + 1, r, max(tl, m + 1), tr, val1, val2);
}
bool meg(int x, int y) {
  int nx = get(x);
  int ny = get(y);
  int cx = get_c(x);
  int cy = get_c(y);
  if (nx == ny) {
    return (cx != cy);
  }
  if (s[nx] > s[ny]) {
    swap(nx, ny);
    swap(cx, cy);
    swap(x, y);
  }
  bl.push_back({&p[nx], nx});
  bl.push_back({&s[ny], ny});
  bl.push_back({&f[nx], nx});
  s[ny] += s[nx];
  p[nx] = ny;
  if (cx == cy) {
    f[nx] = 1;
  } else {
    f[nx] = 0;
  }
  return true;
}
void dell(int i) {
  while ((int)bl.size() > i) {
    *bl.back().first = bl.back().second;
    bl.pop_back();
  }
}
void foo(int x, int l, int r, int ok) {
  int l1 = (int)bl.size();
  int gg = ok;
  for (auto y : t[x]) {
    gg &= meg(y.first, y.second);
  }
  if (l == r) {
    ans[l] = gg;
    return;
  }
  int m = (l + r) / 2;
  foo(x + x, l, m, gg);
  foo(x + x + 1, m + 1, r, gg);
  dell(l1);
}
void solve() {
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    p[i] = i;
    s[i] = 1;
  }
  for (int i = 1; i <= q; i++) {
    int x, y;
    cin >> x >> y;
    if (m[x].find(y) == m[x].end()) {
      m[x][y] = i;
    } else {
      int z = m[x][y];
      upd(1, 1, q, z, i - 1, x, y);
      m[x].erase(y);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (auto x : m[i]) {
      upd(1, 1, q, x.second, q, i, x.first);
    }
  }
  foo(1, 1, q, 1);
  for (int i = 1; i <= q; i++) {
    if (ans[i])
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int T = 1;
  while (T--) {
    solve();
  }
}
