#include <bits/stdc++.h>
using namespace std;
inline int readInt() {
  int n = 0, ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) n = n * 10 + ch - '0', ch = getchar();
  return n;
}
const int MAX_N = 100000 + 3, MAX_Q = 100000 + 3;
struct Edge {
  int from, to;
  Edge(int from, int to) : from(min(from, to)), to(max(from, to)) {}
  bool operator<(const Edge &e) const {
    return from < e.from || (from == e.from && to < e.to);
  }
};
map<Edge, int> ti;
int n, q;
struct DisjointSet {
  static const int MAX_NODE = MAX_N * 2;
  struct Data {
    int idx;
    int fa, rank;
    Data() {}
    Data(int idx, int fa, int rank) : idx(idx), fa(fa), rank(rank) {}
  } stk[MAX_NODE * 4];
  int fa[MAX_NODE], rank[MAX_NODE], sz;
  void init(int n) {
    for (int i = 0; i < n; ++i) fa[i] = i, rank[i] = 1;
    sz = 0;
  }
  int find(int x) { return fa[x] == x ? x : find(fa[x]); }
  inline void unite(int u, int v) {
    u = find(u), v = find(v);
    if (u == v) return;
    stk[sz++] = Data(u, fa[u], rank[u]);
    stk[sz++] = Data(v, fa[v], rank[v]);
    if (rank[u] > rank[v]) swap(u, v);
    fa[u] = v;
    if (rank[u] == rank[v]) ++rank[v];
  }
  inline bool same(int u, int v) { return find(u) == find(v); }
  inline int now() { return sz; }
  void backTo(int t) {
    for (int i = sz - 1; i >= t; --i) {
      Data dat = stk[i];
      fa[dat.idx] = dat.fa, rank[dat.idx] = dat.rank;
    }
    sz = t;
  }
} ds;
inline bool addEdge(int u, int v) {
  ds.unite(u * 2, v * 2 + 1);
  ds.unite(u * 2 + 1, v * 2);
  return !ds.same(u * 2, u * 2 + 1) && !ds.same(v * 2, v * 2 + 1);
}
bool ans[MAX_Q];
namespace SegmentTree {
const int MAX_NODE = (1 << 17) * 2;
vector<Edge> edges[MAX_NODE];
void add(int o, int l, int r, int a, int b, const Edge &e) {
  if (r <= a || l >= b) return;
  if (l >= a && r <= b) return edges[o].push_back(e);
  add((((o) << 1) + 1), l, (((l) + (r)) >> 1), a, b, e);
  add((((o) << 1) + 2), (((l) + (r)) >> 1), r, a, b, e);
}
void dfs(int o, int l, int r) {
  int t = ds.now();
  bool flag = true;
  for (auto &e : edges[o]) {
    if (!addEdge(e.from, e.to)) {
      flag = false;
      break;
    }
  }
  if (r - l == 1 || !flag) {
    for (int i = l; i < r; ++i) ans[i] = flag;
    ds.backTo(t);
    return;
  }
  dfs((((o) << 1) + 1), l, (((l) + (r)) >> 1));
  dfs((((o) << 1) + 2), (((l) + (r)) >> 1), r);
  ds.backTo(t);
}
}  // namespace SegmentTree
using namespace SegmentTree;
int main() {
  n = readInt(), q = readInt();
  for (int i = 0; i < q; ++i) {
    int u = readInt() - 1, v = readInt() - 1;
    Edge e = Edge(u, v);
    if (ti.count(e)) {
      add(0, 0, q, ti[e], i, e);
      ti.erase(ti.find(e));
    } else
      ti[e] = i;
  }
  for (auto pi : ti) add(0, 0, q, pi.second, q, pi.first);
  ds.init(n * 2);
  dfs(0, 0, q);
  for (int i = 0; i < q; ++i) puts(ans[i] ? "YES" : "NO");
  return 0;
}
