You are given an undirected graph consisting of n vertices. Initially there are no edges in the graph. Also you are given q queries, each query either adds one undirected edge to the graph or removes it. After each query you have to check if the resulting graph is bipartite (that is, you can paint all vertices of the graph into two colors so that there is no edge connecting two vertices of the same color).

Input

The first line contains two integers n and q (2 ≤ n, q ≤ 100000).

Then q lines follow. ith line contains two numbers xi and yi (1 ≤ xi < yi ≤ n). These numbers describe ith query: if there is an edge between vertices xi and yi, then remove it, otherwise add it.

Output

Print q lines. ith line must contain YES if the graph is bipartite after ith query, and NO otherwise.

Example

Input

3 5
2 3
1 3
1 2
1 2
1 2


Output

YES
YES
NO
YES
NO
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 1;
struct Event {
  string mas;
  int pos;
  int val;
  Event(string mas = "", int pos = -1, int val = -1)
      : mas(mas), pos(pos), val(val) {}
};
struct Solve {
  int n;
  bool val[MAXN];
  int sz[MAXN];
  int parent[MAXN];
  bool flag[MAXN];
  bool solve = true;
  vector<Event> ev;
  Solve(int n = 0) : n(n) {
    fill(val, val + n, false);
    fill(sz, sz + n, 1);
    fill(flag, flag + n, 0);
    for (int i = 0; i < n; i++) parent[i] = i;
  }
  int get(int v) {
    if (parent[v] == v) return v;
    return get(parent[v]);
  }
  bool get_val(int v) {
    if (parent[v] == v) return flag[v] ^ val[v];
    return flag[v] ^ get_val(parent[v]);
  }
  bool merge(int v1, int v2) {
    if (!solve) return false;
    int a = get(v1);
    int b = get(v2);
    if (a == b) {
      if (get_val(v1) == get_val(v2)) {
        ev.push_back(Event("solve", -1, solve ? 1 : 0));
        solve = false;
        return false;
      }
      return true;
    }
    if (sz[a] < sz[b]) swap(a, b);
    ev.push_back(Event("parent", b, parent[b]));
    ev.push_back(Event("sz", b, sz[b]));
    parent[b] = a;
    sz[b] += sz[a];
    if (get_val(v1) == get_val(v2)) {
      ev.push_back(Event("flag", b, flag[b] ? 1 : 0));
      flag[b] = !flag[b];
    }
    return true;
  }
  void back(int size) {
    for (int i = (int)ev.size() - 1; i >= size; i--) {
      if (ev[i].mas == "solve") solve = ev[i].val;
      if (ev[i].mas == "parent") parent[ev[i].pos] = ev[i].val;
      if (ev[i].mas == "sz") sz[ev[i].pos] = ev[i].val;
      if (ev[i].mas == "flag") flag[ev[i].pos] = ev[i].val;
    }
    ev.resize(size);
  }
  bool add(int u, int v) { return merge(u, v); }
};
struct Request {
  bool type;
  int x, y;
  int pair_num;
  Request(bool type = true, int x = 0, int y = 0, int pair_num = 0)
      : type(type), x(x), y(y), pair_num(pair_num) {}
};
map<pair<int, int>, bool> was;
map<pair<int, int>, int> pos;
vector<Request> req;
vector<int> answer;
Solve s;
void solve(int l, int r) {
  if (l == r - 1) {
    if (req[l].type) answer.push_back(s.solve);
    return;
  }
  int m = (l + r) / 2;
  int sz = (int)s.ev.size();
  for (int i = m; i < r; i++)
    if (!req[i].type && req[i].pair_num < l) s.add(req[i].x, req[i].y);
  solve(l, m);
  s.back(sz);
  for (int i = l; i < m; i++)
    if (!req[i].type && req[i].pair_num >= r) s.add(req[i].x, req[i].y);
  solve(m, r);
  s.back(sz);
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  for (int kek228 = 0; kek228 < m; kek228++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    req.push_back(Request(false, x, y, 1e9));
    if (x > y) swap(x, y);
    if (was[make_pair(x, y)]) {
      was[make_pair(x, y)] = 0;
      req.back().pair_num = pos[make_pair(x, y)];
      req[pos[make_pair(x, y)]].pair_num = (int)req.size() - 1;
    } else {
      was[make_pair(x, y)] = 1;
      pos[make_pair(x, y)] = (int)req.size() - 1;
    }
    req.push_back(Request(true, 0, 0, 0));
  }
  s = Solve(n);
  solve(0, (int)req.size());
  for (int i = 0; i < (int)answer.size(); i++)
    cout << (answer[i] ? "YES" : "NO") << endl;
  return 0;
}
