#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 88;
map<pair<int, int>, int> mp;
pair<int, int> query[maxn];
vector<pair<int, int> > t[4 * maxn];
vector<pair<int *, int> > change[4 * maxn];
int dsu[maxn], sz[maxn], len[maxn];
bool is[maxn], ans[maxn];
void add(int v, int l, int r, int ql, int qr, pair<int, int> z) {
  if (l == ql && r == qr) {
    t[v].push_back(z);
    return;
  }
  int mid = (l + r) >> 1, ls = v << 1, rs = ls | 1;
  if (qr <= mid) {
    add(ls, l, mid, ql, qr, z);
    return;
  }
  if (ql > mid) {
    add(rs, mid + 1, r, ql, qr, z);
    return;
  }
  add(ls, l, mid, ql, mid, z);
  add(rs, mid + 1, r, mid + 1, qr, z);
}
void push(int v, int &a, int b) {
  change[v].push_back({&a, a});
  a = b;
}
int get(int v, int &d) {
  if (dsu[v] == v)
    return v;
  else {
    d += len[v];
    return get(dsu[v], d);
  }
}
bool unite(int v, pair<int, int> u) {
  int dist1 = 0, dist2 = 0;
  int ca = get(u.first, dist1), cb = get(u.second, dist2);
  if (ca == cb && ((dist1 + dist2) & 1) == 0) return false;
  if (ca == cb) return true;
  if (sz[ca] < sz[cb]) {
    swap(dist1, dist2);
    swap(ca, cb);
  }
  push(v, len[cb], dist1 + dist2 + 1);
  push(v, dsu[cb], ca);
  push(v, sz[ca], sz[ca] + sz[cb]);
  return true;
}
void undo(pair<int *, int> x) { *x.first = x.second; }
void dfs(int v, int l, int r) {
  bool check = true;
  for (int i = 0; i < t[v].size(); i++)
    if (!unite(v, t[v][i])) {
      check = false;
      break;
    }
  if (check) {
    if (l == r)
      ans[l] = true;
    else {
      int mid = (l + r) >> 1, ls = v << 1, rs = ls | 1;
      dfs(ls, l, mid);
      dfs(rs, mid + 1, r);
    }
  }
  for (int i = (int)change[v].size() - 1; i >= 0; i--) undo(change[v][i]);
}
int main() {
  int n, q, i, a, b;
  ios_base::sync_with_stdio(0);
  cin >> n >> q;
  for (i = 1; i <= q; i++) {
    cin >> a >> b;
    query[i] = {a, b};
    if (a > b) swap(a, b);
    int pos = mp[{a, b}];
    if (pos != 0) {
      mp[{a, b}] = 0;
      add(1, 1, q, pos, i - 1, query[i]);
      is[pos] = true;
      is[i] = true;
    } else
      mp[{a, b}] = i;
  }
  for (i = 1; i <= q; i++)
    if (!is[i]) add(1, 1, q, i, q, query[i]);
  for (i = 1; i <= n; i++) {
    sz[i] = 1;
    dsu[i] = i;
  }
  dfs(1, 1, q);
  for (i = 1; i <= q; i++)
    if (ans[i])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  return 0;
}
