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;
struct yts {
  int l, r;
  vector<pair<int, int> > v;
} t[4 * 100010];
map<pair<int, int>, int> mp;
int f[100010], st[2000010], lf[2000010], ls[2000010], size[100010], w[100010],
    lw[2000010];
bool ans[100010];
int n, m, top;
pair<int, int> e;
void build(int i, int l, int r) {
  t[i].l = l;
  t[i].r = r;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(i << 1, l, mid);
  build(i << 1 | 1, mid + 1, r);
}
void add(int i, int l, int r) {
  if (l <= t[i].l && t[i].r <= r) {
    t[i].v.push_back(e);
    return;
  }
  int mid = (t[i].l + t[i].r) >> 1;
  if (l <= mid) add(i << 1, l, r);
  if (mid < r) add(i << 1 | 1, l, r);
}
int find(int i) { return f[i] == i ? i : find(f[i]); }
int dep(int i) { return f[i] == i ? 0 : dep(f[i]) ^ w[i]; }
void update(int i, int fa, int SIZE, int W) {
  top++;
  st[top] = i;
  lf[top] = f[i];
  ls[top] = size[i];
  lw[top] = w[i];
  f[i] = fa;
  size[i] = SIZE;
  w[i] = W;
}
void rollback(int i) {
  f[st[i]] = lf[i];
  size[st[i]] = ls[i];
  w[st[i]] = lw[i];
}
void solve(int x, bool W) {
  if (!W) {
    if (t[x].l == t[x].r)
      ans[t[x].l] = W;
    else
      solve(x << 1, W), solve(x << 1 | 1, W);
  } else {
    int T = top;
    for (int i = 0; i < t[x].v.size(); i++) {
      int X = t[x].v[i].first, Y = t[x].v[i].second;
      int f1 = find(X), f2 = find(Y);
      if (f1 == f2) {
        if (dep(X) == dep(Y)) {
          W = 0;
          break;
        }
      } else {
        if (size[f1] < size[f2]) {
          update(f1, f2, size[f1], dep(X) ^ dep(Y) ^ 1),
              update(f2, f2, size[f1] + size[f2], 0);
        } else {
          update(f2, f1, size[f2], dep(X) ^ dep(Y) ^ 1),
              update(f1, f1, size[f1] + size[f2], 0);
        }
      }
    }
    if (t[x].l == t[x].r)
      ans[t[x].l] = W;
    else
      solve(x << 1, W), solve(x << 1 | 1, W);
    while (top > T) rollback(top--);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  build(1, 1, m);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x > y) swap(x, y);
    e = make_pair(x, y);
    if (mp.find(e) == mp.end())
      mp[e] = i;
    else
      add(1, mp[e], i - 1), mp.erase(e);
  }
  for (map<pair<int, int>, int>::iterator i = mp.begin(); i != mp.end(); i++)
    e = (*i).first, add(1, (*i).second, m);
  for (int i = 1; i <= n; i++) f[i] = i, size[i] = 1;
  solve(1, 1);
  for (int i = 1; i <= m; i++)
    if (ans[i])
      puts("YES");
    else
      puts("NO");
  return 0;
}
