#include <bits/stdc++.h>
const int MAXN = 1e5 + 10;
using namespace std;
int N, Q, TRASH;
int pai[MAXN * 2], height[MAXN * 2];
map<pair<int, int>, int> mp;
vector<pair<int, int> > tree[MAXN * 4];
bool not_ok[MAXN * 4];
stack<int> st;
bool ans[MAXN];
int find(int x) {
  while (x != pai[x]) x = pai[x];
  return x;
}
bool join(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) return false;
  if (height[x] > height[y]) swap(x, y);
  if (height[x] == height[y]) height[y]++;
  pai[x] = y;
  st.push(x);
  return true;
}
int m(int l, int r) { return (l + r) >> 1; }
void upd(int pos, int l, int r, int beg, int en, pair<int, int> p) {
  if (l > en || r < beg) return;
  if (l >= beg && r <= en) return (void)(tree[pos].push_back(p));
  upd(pos << 1, l, m(l, r), beg, en, p);
  upd((pos << 1) | 1, m(l, r) + 1, r, beg, en, p);
}
inline void rollback(int moment) {
  while (st.size() > moment) {
    int x = st.top(), y = pai[x];
    st.pop();
    if (height[x] == height[y]) height[y]--;
    pai[x] = x;
  }
}
void run(int pos, int l, int r, bool nao_bom) {
  int moment = (int)st.size();
  ("%d %d %d\n", pos, l, r);
  for (auto p : tree[pos]) {
    ("Joining %d with %d   and  %d with %d\n ", p.first + N, p.second, p.first,
     p.second + N);
    if (find(p.first) == find(p.second)) {
      nao_bom = true;
      break;
    }
    join(p.first + N, p.second);
    join(p.first, p.second + N);
  }
  not_ok[pos] = nao_bom;
  if (l == r) ans[l] = (not_ok[pos]) ? false : true;
  if (l != r) {
    run(pos << 1, l, m(l, r), nao_bom | not_ok[pos]);
    run((pos << 1) | 1, m(l, r) + 1, r, nao_bom | not_ok[pos]);
  }
  rollback(moment);
}
int main() {
  scanf("%d%d", &N, &Q);
  for (int i = 1; i <= Q; i++) {
    int U, V;
    scanf("%d%d", &U, &V);
    pair<int, int> par = make_pair(U, V);
    if (mp.find(par) != mp.end()) {
      upd(1, 1, Q, mp[par], i - 1, par);
      mp.erase(par);
      continue;
    }
    mp.insert(make_pair(par, i));
  }
  for (auto p : mp) upd(1, 1, Q, p.second, Q, p.first);
  for (int i = 1; i <= N; i++) pai[i] = i, pai[i + N] = i + N;
  run(1, 1, Q, false);
  for (int i = 1; i <= Q; i++) printf("%s\n", ans[i] ? "YES" : "NO");
}
