#include <bits/stdc++.h>
using namespace std;
const int MN = 100010;
int N, Q;
map<pair<int, int>, int> chk;
struct Info {
  int u, v, t;
};
struct DSU {
  int fa[MN], rnk[MN], diff[MN];
  void init() {
    for (int i = 0; i < N; i++) {
      fa[i] = i;
      rnk[i] = 0;
      diff[i] = 0;
    }
  }
  int find(int u) {
    if (fa[u] == u)
      return u;
    else
      return find(fa[u]);
  }
  int color(int u) {
    if (fa[u] == u)
      return 0;
    else
      return color(fa[u]) ^ diff[u];
  }
  Info mrg(int u, int v, int c) {
    u = find(u);
    v = find(v);
    if (rnk[u] < rnk[v]) swap(u, v);
    fa[v] = u;
    diff[v] = c;
    if (rnk[u] == rnk[v]) {
      rnk[u]++;
      return {u, v, 1};
    } else
      return {u, v, 0};
  }
} dsu;
struct BIT {
  vector<vector<pair<int, int> > > tree;
  void init() { tree = vector<vector<pair<int, int> > >(4 * Q); }
  void upd(int a, int b, pair<int, int> e, int l, int r, int n) {
    if (b < l || r < a) return;
    if (a <= l && r <= b) {
      tree[n].push_back(e);
      return;
    }
    int m = (l + r) >> 1;
    upd(a, b, e, l, m, 2 * n);
    upd(a, b, e, m + 1, r, 2 * n + 1);
  }
  void dfs(int l, int r, int n, bool ok) {
    vector<Info> undo;
    for (int i = 0; i < tree[n].size(); i++) {
      if (!ok) break;
      int u = tree[n][i].first;
      int v = tree[n][i].second;
      int uc = dsu.color(u);
      int vc = dsu.color(v);
      if (dsu.find(u) == dsu.find(v)) {
        if (uc == vc) ok = false;
        continue;
      }
      undo.push_back(dsu.mrg(u, v, uc == vc));
    }
    if (l == r) {
      if (ok)
        printf("YES\n");
      else
        printf("NO\n");
      for (int i = (int)undo.size() - 1; i >= 0; i--) {
        int u = undo[i].u;
        int v = undo[i].v;
        int t = undo[i].t;
        dsu.fa[v] = v;
        dsu.diff[v] = 0;
        if (t) dsu.rnk[u]--;
      }
      return;
    }
    int m = (l + r) >> 1;
    dfs(l, m, 2 * n, ok);
    dfs(m + 1, r, 2 * n + 1, ok);
    for (int i = (int)undo.size() - 1; i >= 0; i--) {
      int u = undo[i].u;
      int v = undo[i].v;
      int t = undo[i].t;
      dsu.fa[v] = v;
      dsu.diff[v] = 0;
      if (t) dsu.rnk[u]--;
    }
  }
} bit;
int main() {
  scanf("%d %d", &N, &Q);
  bit.init();
  for (int i = 0; i < Q; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    if (u > v) swap(u, v);
    if (chk[{u, v}]) {
      int l = chk[{u, v}] - 1;
      int r = i - 1;
      bit.upd(l, r, {u, v}, 0, Q - 1, 1);
      chk[{u, v}] = 0;
    } else
      chk[{u, v}] = i + 1;
  }
  for (map<pair<int, int>, int>::iterator it = chk.begin(); it != chk.end();
       it++) {
    if (it->second) {
      int l = it->second - 1;
      int r = Q - 1;
      bit.upd(l, r, it->first, 0, Q - 1, 1);
    }
  }
  dsu.init();
  bit.dfs(0, Q - 1, 1, 1);
}
