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>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
int inp() {
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  int sum = 0;
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum;
}
std::unordered_map<int, int> used[100010];
bool ans[100010];
bool have;
int fa[100010], dis[100010], size[100010];
int fx, fy;
int find(int x) { return fa[x] == x ? x : find(fa[x]); }
int get(int x) {
  int ret = 0;
  while (fa[x] != x) {
    ret ^= dis[x];
    x = fa[x];
  }
  return ret;
}
bool insert(int a, int b) {
  have = false;
  if (find(a) == find(b)) {
    return get(a) != get(b);
  } else {
    have = true;
    fx = find(a);
    fy = find(b);
    if (size[fx] > size[fy]) std::swap(fx, fy);
    fa[fx] = fy;
    size[fy] += size[fx];
    dis[fx] ^= get(a) ^ get(b) ^ 1;
    return true;
  }
}
void erase(int a, int b) {
  fa[a] = a;
  size[b] -= size[a];
  dis[a] = 0;
}
struct SEG_Tree {
  struct SEG {
    int l;
    int r;
    std::vector<std::pair<int, int> > vec;
  } t[800010];
  void build(int cur, int l, int r) {
    t[cur].l = l;
    t[cur].r = r;
    if (l == r) return;
    int mid = (l + r) >> 1;
    build(((cur) << 1), l, mid);
    build(((cur) << 1 | 1), mid + 1, r);
  }
  void modify(int cur, int l, int r, std::pair<int, int> c) {
    if (t[cur].l > r || t[cur].r < l) return;
    if (t[cur].l >= l && t[cur].r <= r) {
      t[cur].vec.push_back(c);
      return;
    }
    modify(((cur) << 1), l, r, c);
    modify(((cur) << 1 | 1), l, r, c);
  }
  void solve(int cur, bool flg) {
    std::vector<std::pair<int, int> > v2;
    for (int i = 0; i < t[cur].vec.size(); i++) {
      flg &= insert(t[cur].vec[i].first, t[cur].vec[i].second);
      if (have) v2.push_back(std::make_pair(fx, fy));
    }
    if (t[cur].l == t[cur].r) {
      ans[t[cur].l] = flg;
    } else {
      solve(((cur) << 1), flg);
      solve(((cur) << 1 | 1), flg);
    }
    for (int i = v2.size() - 1; i >= 0; i--) erase(v2[i].first, v2[i].second);
  }
} t;
int x[100010], y[100010];
int main() {
  int ti = clock();
  int n = inp();
  int q = inp();
  t.build(1, 1, q);
  for (register int i = 1; i <= n; i++) {
    fa[i] = i;
    size[i] = 1;
  }
  for (register int i = 1; i <= q; i++) {
    x[i] = inp();
    y[i] = inp();
    if (used[x[i]][y[i]]) {
      t.modify(1, used[x[i]][y[i]], i - 1, std::make_pair(x[i], y[i]));
      used[x[i]][y[i]] = 0;
    } else {
      used[x[i]][y[i]] = i;
    }
  }
  for (register int i = q; i >= 1; i--) {
    if (used[x[i]][y[i]]) {
      t.modify(1, used[x[i]][y[i]], q, std::make_pair(x[i], y[i]));
      used[x[i]][y[i]] = 0;
    }
  }
  t.solve(1, true);
  for (int i = 1; i <= q; i++) {
    if (ans[i])
      puts("YES");
    else
      puts("NO");
  }
}
