#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
struct dsu {
  int fa, sz;
  int c;
};
dsu ufs[maxn];
struct blk {
  int id1, id2;
  dsu a1, a2;
};
stack<blk> stk;
vector<pair<int, int> > add[maxn * 3];
int n, m, cntn, k;
int find(int u) {
  cntn ^= ufs[u].c;
  if (ufs[u].fa == u) return u;
  return find(ufs[u].fa);
}
bool flg = 0;
int join(int u, int v) {
  cntn = 0;
  int ru = find(u);
  int cnt1 = cntn;
  cntn = 0;
  int rv = find(v);
  int cnt2 = cntn;
  if (ru == rv) {
    if ((cnt1 + cnt2 + 1) % 2 == 1)
      return 0;
    else
      return 2;
  }
  if (ufs[ru].sz < ufs[rv].sz) {
    swap(ru, rv);
  }
  blk tp;
  tp.a1 = ufs[ru];
  tp.a2 = ufs[rv];
  tp.id1 = ru;
  tp.id2 = rv;
  stk.push(tp);
  ufs[rv].fa = ru;
  ufs[ru].sz += ufs[rv].sz;
  ufs[rv].c = cnt1 ^ cnt2 ^ 1;
  return 1;
}
void del() {
  blk tp = stk.top();
  stk.pop();
  ufs[tp.id1] = tp.a1;
  ufs[tp.id2] = tp.a2;
}
inline int lc(int u) { return u << 1; }
inline int rc(int u) { return u << 1 | 1; }
inline void mdf(int u, int l, int r, int ql, int qr, pair<int, int> cur) {
  if (ql <= l && r <= qr) {
    add[u].push_back(cur);
    return;
  }
  long long mid = (l + r) / 2;
  if (ql <= mid) mdf(lc(u), l, mid, ql, qr, cur);
  if (mid + 1 <= qr) mdf(rc(u), mid + 1, r, ql, qr, cur);
}
void printu() {
  cout << "ST PRINT U " << endl;
  for (int i = 1; i <= n; i++) {
    cout << ufs[i].fa << ' ';
  }
  cout << endl;
  cout << "P ED U " << endl;
}
inline void dfs(int u, int l, int r) {
  int cou = 0;
  for (int i = 0; i < add[u].size(); i++) {
    int u1 = add[u][i].first;
    int v1 = add[u][i].second;
    int res = join(u1, v1);
    if (res == 0) {
      while (cou--) {
        del();
      }
      for (int j = l; j <= r; j++) {
        printf("NO\n");
      }
      return;
    } else if (res == 1) {
      cou++;
    }
  }
  if (l == r) {
    printf("YES\n");
    while (cou--) {
      del();
    }
    return;
  }
  long long mid = (l + r) / 2;
  dfs(lc(u), l, mid);
  dfs(rc(u), mid + 1, r);
  while (cou--) {
    del();
  }
}
void init() {
  for (int i = 1; i <= n; i++) {
    ufs[i].fa = i;
    ufs[i].sz = 1;
  }
}
map<int, int> mp[maxn];
int main() {
  cin >> n >> m;
  init();
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    if (mp[u].count(v)) {
      mdf(1, 1, m, mp[u][v], i - 1, make_pair(u, v));
      mp[u].erase(mp[u].find(v));
      mp[v].erase(mp[v].find(u));
    } else {
      mp[u][v] = mp[v][u] = i;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (auto it = mp[i].begin(); it != mp[i].end(); it++) {
      if (it->first < i) {
        mdf(1, 1, m, it->second, m, make_pair(it->first, i));
      }
    }
  }
  dfs(1, 1, m);
}
