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 N = 100000;
const int inf = (int)1e9 + 1;
const long long big = (long long)1e18 + 1;
const int P = 31;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int B = 1333;
vector<int> g[N];
bool used[N];
int comp[N];
int color[N];
bool dfs(int u, int c, int type) {
  used[u] = true;
  comp[u] = c;
  color[u] = type;
  for (int v : g[u])
    if (!used[v]) {
      if (!dfs(v, c, 1 - type)) return false;
    } else {
      if (color[v] == color[u]) return false;
    }
  return true;
}
vector<int> g_c[N * 2];
int t_c = 1;
int used_c[N * 2];
int color_c[N * 2];
bool check(int u, int type) {
  used_c[u] = t_c;
  color_c[u] = type;
  for (int v : g_c[u])
    if (used_c[v] != t_c) {
      if (!check(v, 1 - type)) return false;
    } else {
      if (color_c[v] == color_c[u]) return false;
    }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  int n, q;
  cin >> n >> q;
  int a[q][3];
  set<pair<int, int> > s, s1;
  for (int i = 0; i < q; i++) {
    cin >> a[i][1] >> a[i][2];
    a[i][1]--;
    a[i][2]--;
    if (a[i][1] > a[i][2]) swap(a[i][1], a[i][2]);
    if (!s.count({a[i][1], a[i][2]})) {
      a[i][0] = 1;
      s.insert({a[i][1], a[i][2]});
    } else {
      a[i][0] = 2;
      s.erase({a[i][1], a[i][2]});
    }
  }
  for (int st = 0; st < q; st += B) {
    for (int i = 0; i < n; i++) g[i].clear();
    s.clear();
    for (int i = 0; i < st; i++)
      if (a[i][0] == 1)
        s.insert({a[i][1], a[i][2]});
      else
        s.erase({a[i][1], a[i][2]});
    s1.clear();
    for (int i = st; i < min(q, st + B); i++)
      if (s.count({a[i][1], a[i][2]})) {
        s.erase({a[i][1], a[i][2]});
        s1.insert({a[i][1], a[i][2]});
      }
    for (auto it : s) {
      g[it.first].push_back(it.second);
      g[it.second].push_back(it.first);
    }
    fill(used, used + N, false);
    int cnt_comp = 0;
    bool all_ok = true;
    for (int i = 0; i < n; i++)
      if (!used[i])
        if (!dfs(i, cnt_comp++, 0)) all_ok = false;
    if (!all_ok) {
      for (int i = st; i < min(q, st + B); i++) cout << "NO\n";
      continue;
    }
    for (int i = 0; i < cnt_comp * 2; i++) g_c[i].clear();
    for (int i = 0; i < cnt_comp; i++) {
      g_c[i * 2].push_back(i * 2 + 1);
      g_c[i * 2 + 1].push_back(i * 2);
    }
    for (int i = st; i < min(q, st + B); i++) {
      if (a[i][0] == 1)
        s1.insert({a[i][1], a[i][2]});
      else
        s1.erase({a[i][1], a[i][2]});
      bool ok = true;
      vector<int> del;
      for (auto it : s1) {
        if (comp[it.first] == comp[it.second]) {
          if (color[it.first] == color[it.second]) {
            ok = false;
            break;
          }
        } else {
          int u = (color[it.first] == 0 ? comp[it.first] * 2
                                        : comp[it.first] * 2 + 1);
          int v = (color[it.second] == 0 ? comp[it.second] * 2
                                         : comp[it.second] * 2 + 1);
          g_c[u].push_back(v);
          g_c[v].push_back(u);
          del.push_back(u);
          del.push_back(v);
        }
      }
      if (ok) {
        for (int x : del)
          if (used_c[x] != t_c) {
            if (!check(x, 0)) {
              ok = false;
              break;
            }
          }
        t_c++;
      }
      for (int x : del) g_c[x].pop_back();
      cout << (ok ? "YES\n" : "NO\n");
    }
  }
  return 0;
}
