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 = 100010;
int n, q;
bool ans[N];
map<pair<int, int>, int> mp;
vector<pair<int, int> > g[N << 2];
inline void update(int x, int y, pair<int, int> z, int v = 1, int l = 1,
                   int r = q) {
  if (x <= l && r <= y) {
    g[v].push_back(z);
    return;
  }
  int mid = (l + r) >> 1;
  if (x <= mid) update(x, y, z, v << 1, l, mid);
  if (y > mid) update(x, y, z, v << 1 | 1, mid + 1, r);
}
int sta[N], top, fa[N], si[N], d[N];
inline int ask(int x) {
  while (x != fa[x]) x = fa[x];
  return x;
}
inline int dep(int x) {
  int ans = 0;
  while (x != fa[x]) ans ^= d[x], x = fa[x];
  return ans;
}
inline void link(int x, int y) {
  int v = dep(x) ^ dep(y) ^ 1;
  x = ask(x);
  y = ask(y);
  if (si[x] > si[y]) swap(x, y);
  sta[++top] = x;
  fa[x] = y;
  d[x] = v;
  si[y] += si[x];
}
inline void Re() {
  int u = sta[top--];
  for (int i = u; fa[i] != i; i = fa[i]) si[fa[i]] -= si[u];
  fa[u] = u;
}
inline void solve(int v = 1, int l = 1, int r = q) {
  int tm = top, x, y;
  for (vector<pair<int, int> >::iterator it = g[v].begin(); it != g[v].end();
       ++it) {
    x = it->first;
    y = it->second;
    if (ask(x) != ask(y))
      link(x, y);
    else if (dep(x) ^ dep(y) ^ 1) {
      while (top > tm) Re();
      return;
    }
  }
  if (l == r) {
    ans[l] = 1;
    return;
  }
  int mid = (l + r) >> 1;
  solve(v << 1, l, mid);
  solve(v << 1 | 1, mid + 1, r);
  while (top > tm) Re();
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) fa[i] = i, si[i] = 1;
  int t, x, y;
  for (int i = 1; i <= q; ++i) {
    scanf("%d%d", &x, &y);
    if ((t = mp[make_pair(x, y)]))
      update(t, i - 1, make_pair(x, y)), mp[make_pair(x, y)] = 0;
    else
      mp[make_pair(x, y)] = i;
  }
  for (map<pair<int, int>, int>::iterator it = mp.begin(); it != mp.end(); ++it)
    if (it->second) update(it->second, q, it->first);
  solve();
  for (int i = 1; i <= q; ++i) puts(ans[i] ? "YES" : "NO");
  return 0;
}
