#include <bits/stdc++.h>
template <typename T>
void read(T& x) {
  x = 0;
  int flag = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') flag = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  x *= flag;
}
using namespace std;
const int maxn = 200010;
int n, q, f[maxn], sz[maxn], tp;
pair<int, int> sta[maxn], a[maxn];
bool ok[maxn];
struct info {
  int l, r, u, v;
  info() {}
  info(int a, int b, int c, int d) { l = a, r = b, u = c, v = d; }
};
vector<info> seg;
int find(int x) { return f[x] == x ? f[x] : find(f[x]); }
bool check(int x) { return find(x) == find(x + n); }
void link(int u, int v) {
  int r1 = find(u), r2 = find(v);
  if (r1 == r2) return;
  if (sz[r1] > sz[r2]) swap(r1, r2);
  f[r1] = r2, sz[r2] += sz[r1], sta[++tp] = make_pair(r1, r2);
}
void cut(pair<int, int> t) {
  int u = t.first, v = t.second;
  if (f[v] == u) swap(u, v);
  f[u] = u;
  while (f[v] != v) sz[v] -= sz[u], v = f[v];
  sz[v] -= sz[u];
}
map<pair<int, int>, int> mp;
vector<pair<int, int> > edge[maxn << 2];
void modify(int p, int l, int r, int ql, int qr, int u, int v) {
  if (ql <= l && r <= qr) {
    edge[p].push_back(make_pair(u, v));
    return;
  }
  int mid = (l + r) >> 1;
  if (ql <= mid) modify(p << 1, l, mid, ql, qr, u, v);
  if (qr > mid) modify(p << 1 | 1, mid + 1, r, ql, qr, u, v);
}
void dfs(int p, int l, int r, bool flag) {
  int mid = (l + r) >> 1, cur = tp;
  for (int i = 0; i <= (int)edge[p].size() - 1; i++) {
    if (!flag) continue;
    int u = edge[p][i].first, v = edge[p][i].second;
    link(u, v + n), link(v, u + n);
    if (check(u) || check(v)) flag = 0;
  }
  if (l == r) {
    puts(flag ? "YES" : "NO");
    while (tp > cur) cut(sta[tp--]);
    return;
  }
  dfs(p << 1, l, mid, flag), dfs(p << 1 | 1, mid + 1, r, flag);
  while (tp > cur) cut(sta[tp--]);
}
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= (int)2 * n; i++) f[i] = i, sz[i] = 1;
  for (int i = 1; i <= (int)q; i++) {
    scanf("%d %d", &a[i].first, &a[i].second);
    int tmp = mp[a[i]];
    if (!tmp)
      mp[a[i]] = i;
    else {
      ok[tmp] = ok[i] = 1, mp[a[i]] = 0;
      seg.push_back(info(tmp, i - 1, a[i].first, a[i].second));
    }
  }
  for (int i = 1; i <= (int)q; i++)
    if (!ok[i]) seg.push_back(info(mp[a[i]], q, a[i].first, a[i].second));
  for (int i = 0; i <= (int)seg.size() - 1; i++)
    modify(1, 1, q, seg[i].l, seg[i].r, seg[i].u, seg[i].v);
  dfs(1, 1, q, 1);
  return 0;
}
