#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
const int mxN = 1e5 + 5;
const int mxQ = 1e5 + 5;
int N, Q;
map<ii, int> lastseen;
struct UFDS {
  vector<int> p, s;
  vector<ii> history;
  void init(int n) {
    p.assign(n, 0);
    iota((p).begin(), (p).end(), 0);
    s.assign(n, 1);
    history.clear();
  }
  int finds(int i) { return (p[i] == i) ? i : finds(p[i]); }
  bool unions(int i, int j) {
    int x = finds(i), y = finds(j);
    if (x == y) return 0;
    if (s[x] < s[y]) swap(x, y);
    p[y] = x, s[x] += s[y];
    history.emplace_back(x, y);
    return 1;
  }
  int getTime() { return (int)(history).size(); }
  void undo(int t) {
    while ((int)(history).size() > t) {
      ii cur = history.back();
      history.pop_back();
      p[cur.second] = cur.second;
      s[cur.first] -= s[cur.second];
    }
  }
} ufds;
struct Edge {
  int x, y, u, v;
};
bool ans[mxQ];
void dnc(int l, int r, vector<Edge>& edges, bool good) {
  if (l > r) return;
  int t = ufds.getTime();
  int origGood = good;
  vector<Edge> ls, rs;
  int m = (l + r) / 2;
  for (auto& e : edges) {
    if (l == e.x && r == e.y) {
      ufds.unions(e.u, e.v + N);
      ufds.unions(e.u + N, e.v);
      good &= ufds.finds(e.u) != ufds.finds(e.u + N);
      good &= ufds.finds(e.v) != ufds.finds(e.v + N);
    } else if (e.y <= m)
      ls.push_back(e);
    else if (e.x > m)
      rs.push_back(e);
    else
      ls.push_back({e.x, m, e.u, e.v}), rs.push_back({m + 1, e.y, e.u, e.v});
  }
  if (l == r)
    ans[l] = good;
  else if (!good)
    for (int i = (l); i <= (r); ++i) ans[i] = 0;
  else
    dnc(l, m, ls, good), dnc(m + 1, r, rs, good);
  good = origGood;
  ufds.undo(t);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> Q;
  ufds.init(2 * N + 1);
  vector<Edge> edges;
  for (int i = (1); i <= (Q); ++i) {
    int X, Y;
    cin >> X >> Y;
    if (X < Y) swap(X, Y);
    ii c = ii(X, Y);
    if (lastseen.find(c) == lastseen.end())
      lastseen[c] = i;
    else {
      edges.push_back({lastseen[c], i - 1, X, Y});
      lastseen.erase(c);
    }
  }
  for (auto& c : lastseen) {
    edges.push_back({c.second, Q, c.first.first, c.first.second});
  }
  dnc(1, Q, edges, true);
  for (int i = (1); i <= (Q); ++i) {
    cout << (ans[i] ? "YES" : "NO") << '\n';
  }
}
