#include <bits/stdc++.h>
int read() {
  static int ch, x;
  while (isspace(ch = getchar())) {
  }
  x = ch ^ 48;
  while (isdigit(ch = getchar())) x = (((x << 2) + x) << 1) + (ch ^ 48);
  return x;
}
int top;
int fa[100010], col[100010], dep[100010];
int stk[100010 << 1];
std::vector<int> tr[100010 << 2];
typename std::vector<int>::const_iterator it;
struct edge {
  int f, t, tim;
} e[100010];
inline bool cmp(const edge &x, const edge &y) {
  return (x.f == y.f) ? ((x.t == y.t) ? (x.tim < y.tim) : (x.t < y.t))
                      : (x.f < y.f);
}
int calc(const int &x) { return fa[x] ? (calc(fa[x]) ^ col[x]) : 0; }
int findf(const int &x) { return fa[x] ? findf(fa[x]) : x; }
bool unionf(const int &x, const int &y, const int &f) {
  int fx = findf(x), fy = findf(y);
  if (fx != fy) {
    if (dep[fx] < dep[fy]) {
      std::swap(fx, fy);
    } else if (dep[fx] == dep[fy]) {
      ++dep[fx];
      stk[++top] = -fx;
    }
    fa[fy] = fx;
    col[fy] = f;
    stk[++top] = fy;
    return true;
  }
  return false;
}
void undo(const int &tim) {
  while (top > tim) {
    const int x = stk[top--];
    if (x < 0) {
      --dep[-x];
    } else {
      fa[x] = 0;
      col[x] = 0;
    }
  }
}
void modify(const int &o, const int &l, const int &r, const int &L,
            const int &R, const int &v) {
  if (L <= l && r <= R) {
    tr[o].push_back(v);
    return;
  }
  const int mid = (l + r) >> 1;
  if (L <= mid) modify(o << 1, l, mid, L, R, v);
  if (mid < R) modify((o << 1) | 1, mid + 1, r, L, R, v);
}
void dfs(const int &o, const int &l, const int &r) {
  const int cur = top;
  for (it = tr[o].begin(); it != tr[o].end(); ++it) {
    const int x = e[*it].f, y = e[*it].t, f = calc(x) ^ calc(y) ^ 1;
    if (!unionf(x, y, f) && f) {
      for (int i = l; i <= r; ++i) puts("NO");
      undo(cur);
      return;
    }
  }
  if (l == r) {
    puts("YES");
    undo(cur);
    return;
  }
  const int mid = (l + r) >> 1;
  dfs(o << 1, l, mid);
  dfs((o << 1) | 1, mid + 1, r);
  undo(cur);
}
int main() {
  const int n = read(), q = read();
  for (int i = 1; i <= q; ++i) {
    e[i].f = read();
    e[i].t = read();
    e[i].tim = i;
  }
  std::sort(e + 1, e + q + 1, cmp);
  for (int i = 1; i <= q; ++i) {
    if (e[i].f == e[i + 1].f && e[i].t == e[i + 1].t) {
      modify(1, 1, q, e[i].tim, e[i + 1].tim - 1, i);
      ++i;
    } else {
      modify(1, 1, q, e[i].tim, q, i);
    }
  }
  dfs(1, 1, q);
  return 0;
}
