#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int ans, tot, n, q, col[N], f[N], size[N], head[N], to[N << 1], ne[N << 1];
map<int, int> e[N];
struct SGT {
  int L[N << 2], R[N << 2];
  vector<int> v[N << 2][2];
  void build(int k, int l, int r) {
    L[k] = l, R[k] = r;
    if (l == r) return;
    int mid = (l + r) >> 1;
    build(k << 1, l, mid);
    build(k << 1 | 1, mid + 1, r);
  }
  void add(int k, int l, int r, int x, int y) {
    if (L[k] >= l && R[k] <= r) {
      v[k][0].push_back(x);
      v[k][1].push_back(y);
      return;
    }
    int mid = (L[k] + R[k]) >> 1;
    if (l <= mid) add(k << 1, l, r, x, y);
    if (r > mid) add(k << 1 | 1, l, r, x, y);
  }
  void init(int x, int fa, int c) {
    col[x] = c;
    for (int i = head[x]; i; i = ne[i]) {
      int y = to[i];
      if (y == fa) continue;
      init(y, x, c ^ 1);
    }
  }
  int get(int x) { return x == f[x] ? x : get(f[x]); }
  void dfs(int k) {
    int val = ans;
    vector<int> st[2];
    for (int i = 0; i < v[k][0].size(); i++) {
      int x = v[k][0][i], y = v[k][1][i], l = get(x), r = get(y);
      if (l == r) {
        ans |= col[x] == col[y];
        continue;
      }
      if (size[l] < size[r]) swap(l, r), swap(x, y);
      st[0].push_back(x);
      st[1].push_back(r);
      st[0].push_back(y);
      to[++tot] = y;
      ne[tot] = head[x];
      head[x] = tot;
      to[++tot] = x;
      ne[tot] = head[y];
      head[y] = tot;
      init(y, x, col[x] ^ 1);
      f[r] = l;
      size[l] += size[r];
    }
    if (L[k] == R[k])
      puts(ans ? "NO" : "YES");
    else
      dfs(k << 1), dfs(k << 1 | 1);
    for (int i = st[0].size() - 1; i > -1; i--) {
      tot--;
      head[st[0][i]] = ne[head[st[0][i]]];
      if (i >= st[1].size()) continue;
      size[get(st[1][i])] -= size[st[1][i]];
      f[st[1][i]] = st[1][i];
    }
    ans = val;
  }
} T;
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) f[i] = i, size[i] = 1;
  T.build(1, 1, q);
  for (int i = 1, x, y; i <= q; i++) {
    scanf("%d%d", &x, &y);
    if (e[x][y])
      T.add(1, e[x][y], i - 1, x, y), e[x].erase(y);
    else
      e[x][y] = i;
  }
  for (int i = 1; i <= n; i++) {
    for (map<int, int>::iterator j = e[i].begin(); j != e[i].end(); j++) {
      T.add(1, (*j).second, q, i, (*j).first);
    }
  }
  T.dfs(1);
  return 0;
}
