#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T &x) {
  x = 0;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) flag |= c == '-', c = getchar();
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  if (flag) x = -x;
}
template <class T, typename... Tail>
void read(T &x, Tail &...tail) {
  read(x), read(tail...);
}
const int N = 100010;
int fa[N], sz[N], val[N];
int find(int x) { return x == fa[x] ? x : find(fa[x]); }
int get(int x) { return x == fa[x] ? val[x] : (val[x] ^ get(fa[x])); }
vector<pair<int, int> > buf;
bool merge(int x, int y, int t) {
  int fx = find(x), fy = find(y), vx = get(x), vy = get(y);
  if (fx == fy) {
    if (vx ^ vy ^ 1) return false;
    return true;
  }
  if (sz[fx] > sz[fy]) swap(fx, fy);
  fa[fx] = fy, val[fx] = vx ^ vy ^ 1, sz[fy] += sz[fx];
  buf.push_back(pair<int, int>(t, fx));
  return true;
}
int clk;
void trace(int lst) {
  while (buf.size() && buf.back().first > lst) {
    auto u = buf.back().second;
    buf.pop_back();
    sz[fa[u]] -= sz[u], val[u] = 0, fa[u] = u;
  }
  clk = lst;
}
int ans[N];
struct edge {
  int l, r, u, v;
};
void solve(int l, int r, vector<edge> E) {
  bool flag = true;
  for (auto t : E) {
    if (t.l <= l && r <= t.r) {
      if (!merge(t.u, t.v, ++clk)) {
        flag = false;
        break;
      }
    }
  }
  if (!flag) return;
  if (l == r) return ans[l] = true, void();
  int mid = (l + r) >> 1;
  vector<edge> L, R;
  for (auto t : E)
    if (!(t.l <= l && r <= t.r)) {
      if (t.l <= mid) L.push_back(t);
      if (t.r > mid) R.push_back(t);
    }
  int nw = clk;
  solve(l, mid, L), trace(nw), solve(mid + 1, r, R);
}
map<pair<int, int>, int> s;
int main() {
  int n, q;
  read(n, q);
  for (int i = 1; i <= n; i++) fa[i] = i, sz[i] = i;
  vector<edge> tmp;
  for (int i = 1; i <= q; i++) {
    int u, v;
    read(u, v);
    if (u > v) swap(u, v);
    if (s.count(pair<int, int>(u, v)))
      tmp.push_back({s[pair<int, int>(u, v)], i - 1, u, v}),
          s.erase(pair<int, int>(u, v));
    else
      s[pair<int, int>(u, v)] = i;
  }
  for (auto t : s) tmp.push_back({t.second, q, t.first.first, t.first.second});
  solve(1, q, tmp);
  for (int i = 1; i <= q; i++) puts(ans[i] ? "YES" : "NO");
}
