#include <bits/stdc++.h>
using namespace std;
struct BipartiteUnionFind {
  vector<int> parent, rank;
  vector<pair<int*, int> > undo;
  int is_bipartite;
  BipartiteUnionFind(int size = 200100) {
    parent.resize(size);
    iota(parent.begin(), parent.end(), 0);
    rank.assign(size, 0);
    is_bipartite = 1;
  }
  int now() { return undo.size(); }
  int find(int x) {
    if (x == parent[x]) return x;
    int r = find(parent[x]);
    if (r != parent[x]) undo.push_back({&parent[x], parent[x]});
    return parent[x] = r;
  }
  void join(int x, int y) {
    int x20 = find(2 * x);
    int x21 = find(2 * x + 1);
    int y20 = find(2 * y);
    int y21 = find(2 * y + 1);
    if (x20 == y20 || x21 == y21) {
      if (is_bipartite) {
        undo.push_back({&is_bipartite, is_bipartite});
        is_bipartite = 0;
      }
    }
    x = x20;
    y = y21;
    for (int e = 0; e < 2; e++) {
      if (x != y) {
        if (rank[x] > rank[y]) swap(x, y);
        undo.push_back({&parent[x], parent[x]});
        parent[x] = y;
        if (rank[x] == rank[y]) {
          undo.push_back({&rank[y], rank[y]});
          rank[y]++;
        }
      }
      x ^= 1;
      y ^= 1;
    }
    return;
  }
  void roll(int when) {
    for (int e = undo.size() - 1; e >= when; e--)
      *undo[e].first = undo[e].second;
    undo.resize(when);
  }
};
struct edge {
  int ty, u, v, start, end, res;
};
const int maxn = 100100;
edge link[maxn];
BipartiteUnionFind dsu;
void solve(int l, int r) {
  if (l == r) return;
  if (l + 1 == r) {
    int now = dsu.now();
    if (link[l].ty == 1) {
      dsu.join(link[l].u, link[l].v);
    }
    link[l].res = dsu.is_bipartite;
    dsu.roll(now);
    return;
  }
  int m = (l + r) >> 1;
  int now = dsu.now();
  for (int e = m; e < r; e++) {
    if (link[e].ty == 2 && link[e].start < l) {
      dsu.join(link[e].u, link[e].v);
    }
  }
  solve(l, m);
  dsu.roll(now);
  for (int e = l; e < m; e++) {
    if (link[e].ty == 1 && link[e].end >= r) {
      dsu.join(link[e].u, link[e].v);
    }
  }
  solve(m, r);
  dsu.roll(now);
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  map<pair<int, int>, int> when;
  for (int e = 0; e < m; e++) {
    int u, v;
    scanf("%d %d", &u, &v);
    auto it = when.find({u, v});
    if (it == when.end()) {
      link[e] = {1, u, v, e, m, 0};
      when[{u, v}] = e;
    } else {
      link[it->second].end = e;
      link[e] = {2, u, v, it->second, e, 0};
      when.erase(it);
    }
  }
  solve(0, m);
  for (int e = 0; e < m; e++)
    if (link[e].res)
      printf("YES\n");
    else
      printf("NO\n");
  return 0;
}
