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;
namespace UFS {
const int maxn = 1e5;
const int maxm = 2e5;
stack<pair<int, int> > s;
int ufs[maxn + 5], sz[maxn + 5], dis[maxn + 5];
int find(int x, int& d) {
  d = 0;
  int res = x;
  while (res ^ ufs[res]) {
    d ^= dis[res];
    res = ufs[res];
  }
  return res;
}
bool unite(int x, int y, bool& tag) {
  int dx, dy;
  x = find(x, dx), y = find(y, dy);
  if (x != y) {
    if (sz[x] < sz[y]) swap(x, y);
    dis[y] = dx ^ dy ^ 1;
    s.push(pair<int, int>(y, ufs[y]));
    s.push(pair<int, int>(x, sz[x]));
    ufs[y] = x;
    sz[x] += sz[y];
    tag = true;
    return false;
  } else
    tag = false;
  return dx ^ dy ^ 1;
}
struct edge {
  int u, v, w;
  bool flag;
  bool add() { return unite(u, v, flag); }
  void erase() {
    if (flag) {
      pair<int, int> state = s.top();
      s.pop();
      sz[state.first] = state.second;
      state = s.top();
      s.pop();
      ufs[state.first] = state.first;
    }
    flag = false;
  }
} e[maxm + 5];
void init(int n) {
  for (int i = 1; i <= n; ++i) ufs[i] = i, sz[i] = 1;
  while (!s.empty()) s.pop();
}
}  // namespace UFS
struct Edge {
  Edge() {}
  Edge(int _l, int _r, pair<int, int> _eg) { l = _l, r = _r, eg = _eg; }
  int l, r;
  pair<int, int> eg;
};
map<pair<int, int>, int> mp;
vector<int> arr[4 * maxn + 5];
vector<Edge> g;
int n, q, res[maxn + 5];
void modify(int index, int L, int R, int ML, int MR, int id) {
  if (L >= ML && R <= MR) {
    arr[index].push_back(id);
    return;
  }
  int mid = L + R >> 1;
  if (mid >= ML) modify(2 * index, L, mid, ML, MR, id);
  if (MR > mid) modify(2 * index + 1, mid + 1, R, ML, MR, id);
}
void Erase(int index) {
  for (int i = 0; i < arr[index].size(); ++i) UFS::e[arr[index][i]].erase();
}
void solve(int index, int L, int R) {
  for (int i = 0; i < arr[index].size(); ++i) {
    int id = arr[index][i];
    if (UFS::e[id].add()) {
      for (int j = 0; j <= i; ++j) UFS::e[arr[index][j]].erase();
      return;
    }
  }
  if (L == R)
    res[L] = 1;
  else {
    int mid = L + R >> 1;
    solve(2 * index, L, mid);
    solve(2 * index + 1, mid + 1, R);
  }
  Erase(index);
}
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 1, u, v; i <= q; ++i) {
    scanf("%d %d", &u, &v);
    if (u > v) swap(u, v);
    if (mp.count(pair<int, int>(u, v))) {
      int id = mp[pair<int, int>(u, v)];
      mp.erase(pair<int, int>(u, v));
      g[id].r = i - 1;
    } else {
      g.push_back(Edge(i, q, pair<int, int>(u, v)));
      mp[pair<int, int>(u, v)] = g.size() - 1;
    }
  }
  for (int i = 0; i < g.size(); ++i) {
    modify(1, 1, q, g[i].l, g[i].r, i);
    UFS::e[i].u = g[i].eg.first;
    UFS::e[i].v = g[i].eg.second;
  }
  UFS::init(n);
  solve(1, 1, q);
  for (int i = 1; i <= q; ++i) {
    if (res[i])
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
