#include <bits/stdc++.h>
using std::cerr;
using std::endl;
const int N = 2e5 + 233;
int n, m;
std::map<std::pair<int, int>, int> map;
std::vector<std::pair<int, int>> seg[N * 4];
void insert(int p, int l, int r, std::pair<int, int> e, int L, int R) {
  if (l <= L && r >= R) return seg[p].push_back(e), void();
  if (l <= ((L + R) >> 1)) insert((p << 1), l, r, e, L, ((L + R) >> 1));
  if (r > ((L + R) >> 1))
    insert(((p << 1) | 1), l, r, e, ((L + R) >> 1) + 1, R);
}
int fa[N], size[N], dis[N];
int find(int x) { return x == fa[x] ? x : find(fa[x]); }
inline int get_dis(int x) {
  int ret = 0;
  while (x != fa[x]) {
    ret ^= dis[x];
    x = fa[x];
  }
  return ret;
}
struct Node {
  int x, y, s;
} stk[N];
int top;
void divide(int p, int L, int R, int ok) {
  int top_ver = top;
  for (auto e : seg[p]) {
    int x = e.first, y = e.second;
    int u = find(x), v = find(y);
    int dis_x = get_dis(x), dis_y = get_dis(y);
    if (u != v) {
      if (size[u] < size[v]) std::swap(u, v);
      stk[++top] = {u, v, size[v]};
      fa[u] = v, size[v] += size[u];
      dis[u] = dis_x ^ dis_y ^ 1;
    } else {
      if ((dis_x ^ dis_y) == 0) {
        ok = 0;
        break;
      }
    }
  }
  if (!ok) {
    for (int i = L; i <= R; ++i) puts("NO");
  } else if (L == R) {
    puts("YES");
  } else {
    divide((p << 1), L, ((L + R) >> 1), ok);
    divide(((p << 1) | 1), ((L + R) >> 1) + 1, R, ok);
  }
  while (top > top_ver) {
    int x = stk[top].x, y = stk[top].y, s = stk[top].s;
    fa[x] = x, size[y] = s, dis[x] = 0;
    --top;
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (x > y) std::swap(x, y);
    std::pair<int, int> pair = {x, y};
    if (map.find(pair) != map.end()) {
      insert(1, map[pair], i - 1, pair, 1, m);
      map.erase(pair);
    } else {
      map[pair] = i;
    }
  }
  for (auto w : map) {
    insert(1, w.second, m, w.first, 1, m);
  }
  for (int i = 1; i <= n; ++i) fa[i] = i, size[i] = 1;
  divide(1, 1, m, 1);
  return 0;
}
