#include <bits/stdc++.h>
using namespace std;
const int N = 514514;
const int M = 200000;
vector<int> v[N];
map<int, int> mp[N];
int n, m, ll[N], rr[N], f[N], sz[N];
stack<pair<int, int> > s;
int find(int x) { return f[x] == x ? x : find(f[x]); }
void add(int i, int l, int r, int s, int t, int w) {
  if (s <= l && r <= t) {
    v[i].push_back(w);
    return;
  }
  if (s <= ((l + r) >> 1)) add((i << 1), l, ((l + r) >> 1), s, t, w);
  if (t > ((l + r) >> 1)) add((i << 1 | 1), ((l + r) >> 1) + 1, r, s, t, w);
}
void merge(int x, int y) {
  if (x == y) return;
  if (sz[x] > sz[y]) swap(x, y);
  s.push({x, sz[x]});
  f[x] = y, sz[y] += sz[x];
}
void dfs(int i, int l, int r) {
  int mx = s.size(), ok = 1;
  for (int j = 0; j < v[i].size(); j++) {
    int w = v[i][j], u = find(ll[w]), to = find(rr[w]);
    if (u == to) {
      for (int i = l; i <= r; i++) puts("NO");
      ok = 0;
      break;
    }
    merge(find(ll[w] + M), to);
    merge(find(rr[w] + M), u);
  }
  if (ok) {
    if (l == r)
      puts("YES");
    else
      dfs((i << 1), l, ((l + r) >> 1)),
          dfs((i << 1 | 1), ((l + r) >> 1) + 1, r);
  }
  while (s.size() > mx)
    sz[f[s.top().first]] -= s.top().second, f[s.top().first] = s.top().first,
                                            s.pop();
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) f[i] = i, f[i + M] = i + M;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &ll[i], &rr[i]);
    if (!mp[ll[i]][rr[i]])
      mp[ll[i]][rr[i]] = i;
    else
      add(1, 1, m, mp[ll[i]][rr[i]], i - 1, i), mp[ll[i]][rr[i]] = 0;
  }
  for (int i = 1; i <= m; i++)
    if (mp[ll[i]][rr[i]] == i) add(1, 1, m, i, m, i);
  dfs(1, 1, m);
  return 0;
}
