#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, Q = 1e5 + 10;
int n, q;
struct edg {
  int x, y, t;
  bool operator==(edg a) { return x == a.x && y == a.y; }
} e[Q];
bool cmp(edg a, edg b) {
  return a.x < b.x || (a.x == b.x && a.y < b.y) ||
         (a.x == b.x && a.y == b.y && a.t < b.t);
}
class stk {
 private:
  int tp;
  struct elm {
    int x, y, rnk;
  } e[Q << 2];

 public:
  void push(int x, int y, int rnk) {
    e[++tp] = (elm){x, y, rnk};
    return;
  }
  elm top() { return e[tp]; }
  int size() { return tp; }
  void pop() {
    if (tp) tp--;
    return;
  }
} s;
class ufs {
 private:
  struct elm {
    int fth, rnk;
  } d[N << 1];

 public:
  void init() {
    for (int i = 1; i <= (n << 1); i++) d[i].fth = i, d[i].rnk = 0;
    return;
  }
  inline int find(int x) {
    while (x != d[x].fth) x = d[x].fth;
    return x;
  }
  bool check(int x, int y) { return find(x) == find(y); }
  void unite(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return;
    if (d[x].rnk < d[y].rnk) swap(x, y);
    s.push(x, y, d[x].rnk == d[y].rnk);
    d[y].fth = x;
    d[x].rnk += d[x].rnk == d[y].rnk;
    return;
  }
  void divide() {
    int x = s.top().x, y = s.top().y;
    d[y].fth = y;
    d[x].rnk -= s.top().rnk;
    s.pop();
    return;
  }
} u;
class sgt {
 private:
  struct elm {
    int x, y;
  };
  vector<elm> v[Q << 2];

 public:
  void insert(int i, int l, int r, int lq, int rq, int x, int y) {
    if (l > rq || r < lq) return;
    if (l >= lq && r <= rq) {
      v[i].push_back((elm){x, y});
      return;
    }
    int mid = l + r >> 1;
    insert(i << 1, l, mid, lq, rq, x, y);
    insert(i << 1 | 1, mid + 1, r, lq, rq, x, y);
    return;
  }
  void query(int i, int l, int r) {
    int sz = s.size();
    bool flag = true;
    for (int j = 0; j < v[i].size() && flag; j++) {
      int x = v[i][j].x, y = v[i][j].y;
      if (u.check(x, y))
        flag = false;
      else
        u.unite(x, y + n), u.unite(x + n, y);
    }
    if (flag) {
      if (l == r)
        puts("YES");
      else {
        int mid = l + r >> 1;
        query(i << 1, l, mid);
        query(i << 1 | 1, mid + 1, r);
      }
    } else
      for (int i = l; i <= r; i++) puts("NO");
    while (s.size() > sz) u.divide();
    return;
  }
} t;
inline int rd() {
  int f = 1, x = 0;
  char c = getchar();
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) x = (x << 3) + (x << 1) + c - '0';
  return f * x;
}
int main() {
  n = rd(), q = rd();
  u.init();
  for (int i = 1; i <= q; i++) e[i].x = rd(), e[i].y = rd(), e[i].t = i;
  sort(e + 1, e + 1 + q, cmp);
  for (int i = 1; i <= q; i++) {
    if (e[i] == e[i + 1])
      t.insert(1, 1, q, e[i].t, e[i + 1].t - 1, e[i].x, e[i].y), i++;
    else
      t.insert(1, 1, q, e[i].t, q, e[i].x, e[i].y);
  }
  t.query(1, 1, q);
  return 0;
}
