#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int oo = 1e9;
const int N = 200000;
int n, q, dsu[N], sz[N], sw[N], broken = 0, ans[N];
map<pair<int, int>, vector<pair<int, int> > > ranges;
vector<pair<int, int> > seg[4 * N];
int find(int u) { return dsu[u] == u ? u : find(dsu[u]); }
int getColor(int u) {
  int ans = 0;
  while (dsu[u] != u) {
    ans ^= sw[u];
    u = dsu[u];
  }
  return ans;
}
struct state {
  int no, no2, a1, b1, c1, val;
  state(int _no, int _a1, int _b1, int _no2, int _c1) {
    no = _no, a1 = _a1, b1 = _b1, c1 = _c1, val = 0, no2 = _no2;
  }
  state(int _val) {
    no = a1 = b1 = c1 = -1;
    val = _val;
  }
};
vector<state> rlb;
void rollback() {
  state cur = rlb.back();
  rlb.pop_back();
  if (cur.no != -1) {
    dsu[cur.no] = cur.a1;
    sw[cur.no] = cur.b1;
    sz[cur.no2] = cur.c1;
  }
  broken += cur.val;
}
void unite(int a, int b) {
  int ra = find(a), rb = find(b);
  int ca = getColor(a), cb = getColor(b);
  if (ra == rb) {
    if (ca == cb) {
      broken++;
      rlb.push_back(-1);
    } else {
      rlb.push_back(0);
    }
  } else {
    if (sz[ra] < sz[rb]) swap(ra, rb);
    rlb.push_back(state(rb, dsu[rb], sw[rb], ra, sz[ra]));
    sw[rb] = (ca == cb);
    dsu[rb] = ra;
    sz[ra] += sz[rb];
  }
}
void insert(int n, int s, int e, int l, int r, pair<int, int> ed) {
  if (s > r || e < l) return;
  if (s >= l && e <= r) {
    seg[n].push_back(ed);
    return;
  }
  insert(2 * n, s, (s + e) / 2, l, r, ed);
  insert(2 * n + 1, (s + e) / 2 + 1, e, l, r, ed);
}
void dfs(int n, int s, int e) {
  for (auto cur : seg[n]) {
    unite(cur.first, cur.second);
  }
  if (s != e) {
    dfs(2 * n, s, (s + e) / 2);
    dfs(2 * n + 1, (s + e) / 2 + 1, e);
  } else {
    ans[s] = (broken == 0);
  }
  for (auto cur : seg[n]) {
    rollback();
  }
}
int main() {
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) {
    dsu[i] = i;
    sz[i] = 1;
  }
  for (int i = 1, u, v; i <= q; ++i) {
    scanf("%d%d", &u, &v);
    if (u > v) swap(u, v);
    if (ranges[make_pair(u, v)].size() == 0 ||
        ranges[make_pair(u, v)].back().second != -1) {
      ranges[make_pair(u, v)].push_back(make_pair(i, -1));
    } else {
      ranges[make_pair(u, v)].back().second = i - 1;
    }
  }
  for (auto cur : ranges) {
    vector<pair<int, int> > &g = cur.second;
    for (int j = 0; j < g.size(); ++j) {
      pair<int, int> go = g[j];
      if (go.second == -1) go.second = q;
      insert(1, 1, q, go.first, go.second, cur.first);
    }
  }
  dfs(1, 1, q);
  for (int i = 1; i <= q; ++i) {
    puts(ans[i] ? "YES" : "NO");
  }
  return 0;
}
