#include <bits/stdc++.h>
int fa[(100010)], rnk[(100010)], c[(100010)], ver, stk[(100010)];
int find(int x) {
  for (; x != fa[x]; x = fa[x])
    ;
  return x;
}
int dist(int x) {
  int ans = 0;
  for (; fa[x] && fa[x] != x; x = fa[x]) ans ^= c[x];
  return ans;
}
void merge(int x, int y, int z) {
  x = find(x);
  y = find(y);
  if (x == y) return;
  if (rnk[x] > rnk[y]) std::swap(x, y);
  if (rnk[x] == rnk[y]) ++rnk[y], stk[++ver] = -y;
  fa[x] = y;
  c[x] = z;
  stk[++ver] = x;
}
void restore(int now) {
  for (; ver > now; --ver) {
    if (stk[ver] < 0)
      --rnk[-stk[ver]];
    else
      fa[stk[ver]] = stk[ver], c[stk[ver]] = 0;
  }
}
struct edge {
  int x, y, s, t;
  edge(int i = 0, int j = 0, int k = 0, int l = 0) : x(i), y(j), s(k), t(l) {}
};
void divide(int l, int r, std::vector<edge> &e) {
  int i, mid = l + r >> 1, now = ver;
  std::vector<edge> L, R;
  for (auto it : e) {
    if (it.s == l && it.t == r) {
      int a = find(it.x), b = find(it.y), c = dist(it.x) ^ dist(it.y) ^ 1;
      if (a != b)
        merge(a, b, c);
      else if (c & 1) {
        for (int i = l; i <= r; ++i) {
          puts("NO");
        }
        restore(now);
        return;
      }
    } else if (it.t <= mid)
      L.push_back(it);
    else if (it.s > mid)
      R.push_back(it);
    else {
      L.push_back(edge(it.x, it.y, it.s, mid));
      R.push_back(edge(it.x, it.y, mid + 1, it.t));
    }
  }
  if (l == r)
    puts("YES");
  else
    divide(l, mid, L), divide(mid + 1, r, R);
  restore(now);
}
int n, q;
bool cmp(edge &a, edge &b) { return a.s < b.s; }
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) fa[i] = i;
  std::vector<edge> vec;
  std::map<std::pair<int, int>, int> map;
  for (int i = 1; i <= q; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x > y) std::swap(x, y);
    if (!map.count({x, y})) {
      map[{x, y}] = i;
    } else {
      vec.push_back(edge(x, y, map[{x, y}], i - 1));
      map.erase({x, y});
    }
  }
  for (auto v : map) {
    vec.push_back(edge(v.first.first, v.first.second, v.second, q));
  }
  divide(1, q, vec);
  return 0;
}
