#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MOD = 1000000007;
int bcj[200010], siz[200010];
stack<pii> res;
void init(int n) {
  for (int i = (0); i < (n + 2); i++) bcj[i] = i, siz[i] = 1;
}
int groot(int n) { return (bcj[n] == n) ? n : groot(bcj[n]); }
bool merg(int u, int v) {
  u = groot(u), v = groot(v);
  if (u == v) return 0;
  if (siz[u] > siz[v]) swap(u, v);
  res.push({u, v});
  bcj[u] = v;
  siz[v] += siz[u];
  return 1;
}
void redact() {
  assert(res.size());
  pii k = res.top();
  res.pop();
  bcj[k.first] = k.first;
  bcj[k.second] = k.second;
  siz[k.second] -= siz[k.first];
}
void redact(int n) {
  while (res.size() != n) redact();
}
struct cmd {
  int s, t;
};
int ans[1 << 18];
vector<cmd> queries[1 << 20];
int N;
void insert(int idx, int l, int r, int L, int R, cmd q) {
  if (r - l < 0) return;
  if (L <= l && r <= R) {
    queries[idx].push_back(q);
    return;
  }
  if (R < l || r < L) return;
  insert(2 * idx, l, (l + r) / 2, L, R, q);
  insert(2 * idx + 1, (l + r) / 2 + 1, r, L, R, q);
}
void dfs(int idx, int l, int r) {
  if (r - l < 0) return;
  int sz = res.size();
  for (cmd& k : queries[idx]) {
    merg(k.s, k.t + N);
    merg(k.t, k.s + N);
    if (groot(k.s) == groot(k.s + N) || groot(k.t) == groot(k.t + N))
      return redact(sz);
  }
  if (r - l == 0) return ans[l] = 1, void();
  dfs(2 * idx, l, (l + r) / 2);
  dfs(2 * idx + 1, (l + r) / 2 + 1, r);
  redact(sz);
}
map<int, int> edges[100005];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int q;
  cin >> N >> q;
  init(2 * N + 1);
  for (int i = (1); i < ((q) + 1); i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    assert(x < y);
    if (edges[x][y] == 0)
      edges[x][y] = i;
    else {
      insert(1, 0, q + 3, edges[x][y], i - 1, {x, y});
      edges[x][y] = 0;
    }
  }
  for (int i = (0); i < (N); i++)
    for (auto k : edges[i])
      if (k.second) insert(1, 0, q + 3, k.second, q, {i, k.first});
  dfs(1, 0, q + 3);
  for (int i = (1); i < ((q) + 1); i++) cout << (ans[i] ? "YES\n" : "NO\n");
}
