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 double PI = acos(0) * 2;
const double EPS = 1e-8;
const long long MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int oo = 1e9;
const double foo = 1e30;
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcounll(s);
}
template <class T>
T sqr(T x) {
  return x * x;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
vector<pair<int, int> > has[MAXN * 16];
int par[MAXN], _size[MAXN], col[MAXN];
pair<int, int> ed[MAXN * 2];
int n, E, check, q;
map<pair<int, int>, int> mm;
void update(int node, int L, int R, int l, int r, int x, int y) {
  if (L > r || l > R) return;
  if (l <= L && R <= r) {
    has[node].push_back(make_pair(x, y));
    return;
  }
  if (L < R) {
    int mid = (L + R) >> 1;
    update(node * 2, L, mid, l, r, x, y);
    update(node * 2 + 1, mid + 1, R, l, r, x, y);
  }
}
int getPar(int u) { return par[u] == u ? u : getPar(par[u]); }
int getCol(int u) { return par[u] == u ? 0 : col[u] ^ getCol(par[u]); }
void undo_move(int node) {
  for (int i = ((int)(has[node]).size()) - 1; i >= 0; i--) {
    pair<int, int> cur = ed[--E];
    if (cur.first == -1) continue;
    if (cur.first == -2) {
      check = 0;
      continue;
    }
    par[cur.first] = cur.first;
    _size[cur.second] -= _size[cur.first];
    col[cur.first] = 0;
  }
}
void go(int node, int L, int R) {
  for (int i = 0; i < ((int)(has[node]).size()); i++) {
    if (check) {
      ed[E++] = make_pair(-1, -1);
    } else {
      int A = getPar(has[node][i].first), B = getPar(has[node][i].second);
      if (A != B) {
        if (_size[A] > _size[B]) swap(A, B);
        par[A] = B;
        _size[B] += _size[A];
        ed[E++] = make_pair(A, B);
        if (getCol(has[node][i].first) == getCol(has[node][i].second))
          col[A] = 1;
      } else {
        if (getCol(has[node][i].first) != getCol(has[node][i].second))
          ed[E++] = make_pair(-1, -1);
        else {
          ed[E++] = make_pair(-2, -2);
          check = 1;
        }
      }
    }
  }
  if (L < R) {
    int mid = (L + R) >> 1;
    go(node * 2, L, mid);
    go(node * 2 + 1, mid + 1, R);
  } else {
    if (check)
      puts("NO");
    else
      puts("YES");
  }
  undo_move(node);
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 0; i < q; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--;
    y--;
    if (x > y) swap(x, y);
    if (mm.find(make_pair(x, y)) != mm.end()) {
      update(1, 0, q - 1, mm[make_pair(x, y)], i - 1, x, y);
      mm.erase(make_pair(x, y));
    } else
      mm[make_pair(x, y)] = i;
  }
  for (map<pair<int, int>, int>::iterator it = mm.begin(); it != mm.end();
       it++) {
    update(1, 0, q - 1, it->second, q - 1, it->first.first, it->first.second);
  }
  for (int i = 0; i < n; i++) {
    par[i] = i;
    _size[i] = 1;
  }
  check = 0;
  go(1, 0, q - 1);
  return 0;
}
