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 MAX_N = 100000 + 3, MAX_Q = 100000 + 3;
struct Edge {
  int from, to;
  Edge(int from, int to) : from(min(from, to)), to(max(from, to)) {}
  bool operator<(const Edge &e) const {
    return from < e.from || (from == e.from && to < e.to);
  }
};
struct Data {
  int idx;
  int fa, rank;
  Data() {}
  Data(int idx, int fa, int rank) : idx(idx), fa(fa), rank(rank) {}
};
struct DisjointSet {
  static const int MAX_NODE = MAX_N * 2;
  Data stk[MAX_NODE * 4];
  int fa[MAX_NODE], rank[MAX_NODE], sz;
  void init(int n) {
    for (int i = 0; i < n; ++i) fa[i] = i, rank[i] = 1;
    sz = 0;
  }
  int find(int x) { return fa[x] == x ? x : find(fa[x]); }
  inline void unite(int u, int v) {
    u = find(u), v = find(v);
    if (u == v) return;
    stk[sz++] = Data(u, fa[u], rank[u]);
    stk[sz++] = Data(v, fa[v], rank[v]);
    if (rank[u] > rank[v]) swap(u, v);
    fa[u] = v;
    if (rank[u] == rank[v]) ++rank[v];
  }
  inline bool same(int u, int v) { return find(u) == find(v); }
  inline int now() { return sz; }
  void backTo(int t) {
    for (int i = sz - 1; i >= t; --i) {
      Data dat = stk[i];
      fa[dat.idx] = dat.fa, rank[dat.idx] = dat.rank;
    }
    sz = t;
  }
} ds;
struct SegmentTree {
  vector<Edge> edges[4 * MAX_N];
  bool ans[MAX_Q];
  inline bool addEdge(int u, int v) {
    ds.unite(u * 2, v * 2 + 1);
    ds.unite(u * 2 + 1, v * 2);
    return !ds.same(u * 2, u * 2 + 1) && !ds.same(v * 2, v * 2 + 1);
  }
  void add(int o, int l, int r, int a, int b, const Edge &e) {
    if (r <= a || l >= b) return;
    if (l >= a && r <= b) return edges[o].push_back(e);
    add((((o) << 1) + 1), l, (((l) + (r)) >> 1), a, b, e);
    add((((o) << 1) + 2), (((l) + (r)) >> 1), r, a, b, e);
  }
  void dfs(int o, int l, int r) {
    int t = ds.now();
    bool flag = true;
    for (auto &e : edges[o]) {
      if (!addEdge(e.from, e.to)) {
        flag = false;
        break;
      }
    }
    if (r - l == 1 || !flag) {
      for (int i = l; i < r; ++i) ans[i] = flag;
      ds.backTo(t);
      return;
    }
    dfs((((o) << 1) + 1), l, (((l) + (r)) >> 1));
    dfs((((o) << 1) + 2), (((l) + (r)) >> 1), r);
    ds.backTo(t);
  }
} st;
map<Edge, int> ti;
int n, q;
int main() {
  cin >> n >> q;
  for (int i = 0; i < q; ++i) {
    int u, v;
    cin >> u >> v;
    --u;
    --v;
    Edge e = Edge(u, v);
    if (ti.count(e)) {
      st.add(0, 0, q, ti[e], i, e);
      ti.erase(ti.find(e));
    } else
      ti[e] = i;
  }
  for (auto pi : ti) st.add(0, 0, q, pi.second, q, pi.first);
  ds.init(n * 2);
  st.dfs(0, 0, q);
  for (int i = 0; i < q; ++i) cout << (st.ans[i] ? "YES" : "NO") << endl;
  return 0;
}
