#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4e5 + 1;
stack<pair<int, int> > S;
vector<pair<int, int> > ent[MAXN];
unordered_map<int, int> rem[MAXN];
int son[2][MAXN], n, q, ans[MAXN], tot;
namespace DSU {
int f[MAXN], re[MAXN], siz[MAXN];
inline void init(void) {
  for (int i = 1; i <= n; ++i) f[i] = i;
}
int find(int x) {
  while (x != f[x]) x = f[x];
  return x;
}
int getdis(int x) {
  static int res;
  res = 0;
  while (x != f[x]) res ^= re[x], x = f[x];
  return res;
}
bool add(int u, int v) {
  static int du, dv;
  du = getdis(u), dv = getdis(v);
  u = find(u), v = find(v);
  if (u == v) return du ^ dv;
  if (siz[u] > siz[v]) swap(u, v), swap(du, dv);
  f[u] = v, ++siz[v];
  re[u] = (3 - dv + du) & 1;
  S.push(pair<int, int>(u, v));
  return true;
}
void del(int u, int v) {
  f[u] = u;
  --siz[v];
  re[u] = 0;
}
}  // namespace DSU
void build(const int& l, const int& r, const int& u) {
  if (l == r) return;
  int mid = (l + r) >> 1;
  son[0][u] = ++tot, son[1][u] = ++tot;
  build(l, mid, son[0][u]), build(mid + 1, r, son[1][u]);
}
void modify(const int& l, const int& r, const int& u, const int& L,
            const int& R, const pair<int, int> e) {
  if (l >= L && r <= R) {
    ent[u].push_back(e);
    return;
  }
  int mid = (l + r) >> 1;
  if (mid >= L) modify(l, mid, son[0][u], L, R, e);
  if (mid < R) modify(mid + 1, r, son[1][u], L, R, e);
}
void solve(const int& l, const int& r, const int& u) {
  using namespace DSU;
  int flag = 1, tmp = S.size(), mid = (l + r) >> 1;
  for (auto t : ent[u])
    if (!add(t.first, t.second)) {
      flag = 0;
      break;
    }
  if (flag) {
    if (l == r)
      ans[l] = 1;
    else
      solve(l, mid, son[0][u]), solve(mid + 1, r, son[1][u]);
  }
  while (S.size() != tmp) {
    del(S.top().first, S.top().second);
    S.pop();
  }
  return;
}
int main(void) {
  scanf("%d%d", &n, &q);
  build(1, q, 0);
  for (int i = 1, u, v; i <= q; ++i) {
    scanf("%d%d", &u, &v);
    if (u > v) swap(u, v);
    if (rem[u][v] > 0) {
      modify(1, q, 0, rem[u][v], i - 1, pair<int, int>(u, v));
      rem[u][v] = 0;
    } else
      rem[u][v] = i;
  }
  for (int i = 1; i <= n; ++i)
    for (auto t : rem[i])
      if (t.second > 0)
        modify(1, q, 0, t.second, q, pair<int, int>(i, t.first));
  DSU::init();
  solve(1, q, 0);
  for (int i = 1; i <= q; ++i)
    if (ans[i])
      printf("YES\n");
    else
      printf("NO\n");
  return 0;
}
