#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
struct node {
  int fu, fv;
  node() {}
  node(int fu, int fv) {
    this->fu = fu;
    this->fv = fv;
  }
};
vector<pair<int, int> > vec[maxn << 2];
map<pair<int, int>, int> mp;
node stk[maxn];
int f[maxn], rnk[maxn];
int n, q, tp;
int ufind(int x) { return x == f[x] ? x : ufind(f[x]); }
void merge(int u, int v) {
  int fu = ufind(u), fv = ufind(v);
  if (fu == fv) return;
  if (rnk[fu] > rnk[fv]) swap(fu, fv);
  f[fu] = fv;
  rnk[fv] += rnk[fu];
  stk[++tp] = node(fu, fv);
}
void undo(int cur) {
  while (tp > cur) {
    auto x = stk[tp];
    --tp;
    f[x.fu] = x.fu;
    f[x.fv] = x.fv;
    rnk[x.fv] -= rnk[x.fu];
  }
  return;
}
void update(int o, int L, int R, int l, int r, pair<int, int> v) {
  int lch = o * 2, rch = o * 2 + 1;
  if (l <= L && R <= r) {
    vec[o].emplace_back(v);
    return;
  }
  int mid = (L + R) / 2;
  if (l <= mid) update(lch, L, mid, l, r, v);
  if (r > mid) update(rch, mid + 1, R, l, r, v);
  return;
}
void query(int o, int L, int R) {
  int lch = o * 2, rch = o * 2 + 1;
  int cur = tp;
  for (auto& tmp : vec[o]) {
    int u = tmp.first, v = tmp.second;
    int fu = ufind(u), fv = ufind(v);
    if (fu == fv) {
      for (int i = L; i <= R; i++) printf("NO\n");
      undo(cur);
      return;
    } else {
      merge(u, v + n);
      merge(v, u + n);
    }
  }
  if (L == R) {
    printf("YES\n");
    undo(cur);
    return;
  }
  int mid = (L + R) / 2;
  query(lch, L, mid);
  query(rch, mid + 1, R);
  undo(cur);
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= 2 * n; i++) f[i] = i;
  for (int i = 1; i <= q; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    auto x = make_pair(u, v);
    if (!mp.count(x))
      mp[x] = i;
    else {
      update(1, 1, q, mp[x], i - 1, x);
      mp.erase(x);
    }
  }
  for (auto& tmp : mp) {
    update(1, 1, q, tmp.second, q, tmp.first);
  }
  query(1, 1, q);
  return 0;
}
