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>
namespace MyMinMax {
template <typename T>
inline T mn(const T x, const T y) {
  return x < y ? x : y;
}
template <typename T>
inline T mx(const T x, const T y) {
  return x > y ? x : y;
}
template <typename T>
inline bool chmin(T &x, const T y) {
  return (x > y) && ((x = y), 1);
}
template <typename T>
inline bool chmax(T &x, const T y) {
  return (x < y) && ((x = y), 1);
}
template <typename T, typename... Args>
inline T mx(const T x, const Args... args) {
  return mx(x, mx(args...));
}
template <typename T, typename... Args>
inline T mn(const T x, const Args... args) {
  return mn(x, mn(args...));
}
}  // namespace MyMinMax
using namespace MyMinMax;
namespace IO {
const int DPAIRSIZ = 1 << 18;
char BB[DPAIRSIZ], *SS = BB, *TT = BB;
inline char getcha() {
  return SS == TT && (TT = (SS = BB) + fread(BB, 1, DPAIRSIZ, stdin), SS == TT)
             ? EOF
             : *SS++;
}
template <typename T = int>
inline T read() {
  T x = 0;
  int fu = 1;
  char c = getcha();
  while (c > 57 || c < 48) {
    if (c == 45) fu = -1;
    c = getcha();
  }
  while (c <= 57 && c >= 48) {
    x = x * 10 + c - 48;
    c = getcha();
  }
  x *= fu;
  return x;
}
template <typename T>
inline void read(T &x) {
  x = 0;
  int fu = 1;
  char c = getcha();
  while (c > 57 || c < 48) {
    if (c == 45) fu = -1;
    c = getcha();
  }
  while (c <= 57 && c >= 48) {
    x = x * 10 + c - 48;
    c = getcha();
  }
  x *= fu;
}
template <typename T>
inline void read(T *bg, T *ed) {
  while (bg != ed) read(*bg++);
}
inline void read(char &ch) {
  ch = getcha();
  while (ch <= 32) ch = getcha();
}
inline void read(char *s) {
  char ch = getcha();
  while (ch <= 32) ch = getcha();
  while (ch > 32) *s++ = ch, ch = getcha();
  *s = '\0';
}
inline void sread(char *s) {
  char ch = getcha();
  while (ch < 32) ch = getcha();
  while (ch >= 32) *s++ = ch, ch = getcha();
  *s = '\0';
}
inline void pread(char *&s) {
  char ch = getcha();
  while (ch <= 32) ch = getcha();
  while (ch > 32) *s++ = ch, ch = getcha();
  *s = '\0';
}
inline void spread(char *&s) {
  char ch = getcha();
  while (ch < 32) ch = getcha();
  while (ch >= 32) *s++ = ch, ch = getcha();
  *s = '\0';
}
template <typename T, typename... Args>
inline void read(T &x, Args &...args) {
  read(x);
  read(args...);
}
char out[DPAIRSIZ], *Out = out;
inline void putcha(char x) {
  *Out++ = x;
  if (Out - out >= (DPAIRSIZ)) fwrite(out, 1, Out - out, stdout), Out = out;
}
template <typename T>
inline void fprint(T x) {
  if (x < 0) putcha(45), x = -x;
  if (x > 9) fprint(x / 10);
  putcha(x % 10 + 48);
}
inline void print() { putcha(10); }
template <typename T>
inline void print(T x) {
  fprint(x);
  putcha(10);
}
inline void print(char *ch) {
  while (*ch != '\0') putcha(*(ch++));
  putcha(10);
}
inline void put(char *ch) {
  while (*ch != '\0') putcha(*(ch++));
}
inline void print(const char *ch) {
  while (*ch != '\0') putcha(*(ch++));
  putcha(10);
}
inline void put(const char *ch) {
  while (*ch != '\0') putcha(*(ch++));
}
template <typename T, typename... Args>
inline void print(T x, Args... args) {
  fprint(x);
  putcha(32);
  print(args...);
}
template <typename... Args>
inline void print(const char *ch, Args... args) {
  while (*ch != '\0') putcha(*(ch++));
  putcha(32);
  print(args...);
}
template <typename... Args>
inline void print(char *ch, Args... args) {
  while (*ch != '\0') putcha(*(ch++));
  putcha(32);
  print(args...);
}
template <typename T, typename... Args>
inline void printl(T x, Args... args) {
  fprint(x);
  putcha(10);
  printl(args...);
}
template <typename... Args>
inline void printl(const char *ch, Args... args) {
  while (*ch != '\0') putcha(*(ch++));
  putcha(10);
  printl(args...);
}
template <typename... Args>
inline void printl(char *ch, Args... args) {
  while (*ch != '\0') putcha(*(ch++));
  putcha(10);
  printl(args...);
}
template <typename T>
inline void sprint(T x) {
  fprint(x);
  putcha(32);
}
template <typename T, typename... Args>
inline void sprint(T x, Args... args) {
  fprint(x);
  putcha(32);
  sprint(args...);
}
template <typename T>
inline void sprint(T *bg, T *ed) {
  while (bg != ed) sprint(*bg++);
}
template <typename T>
inline void print(T *bg, T *ed) {
  while (bg != ed) sprint(*bg++);
  putcha(10);
}
template <typename T>
inline void printl(T *bg, T *ed) {
  while (bg != ed) print(*bg++);
}
class AutoFlush {
 public:
  ~AutoFlush() { fwrite(out, 1, Out - out, stdout); }
} __AutoFlush;
}  // namespace IO
using namespace IO;
const int INF = 0x3f3f3f3f;
const long long INFll = 0x3f3f3f3f3f3f3f3fll;
const int MAXN = 1e5 + 5;
std::map<std::pair<int, int>, int> f;
int lst[MAXN], u[MAXN], v[MAXN], tot;
int n, m;
std::vector<int> t[MAXN << 2];
void modify(int rt, int l, int r, int x, int y, int z) {
  if (x <= l && r <= y) return t[rt].push_back(z);
  int mid = (l + r) >> 1;
  if (x <= mid) modify(rt << 1, l, mid, x, y, z);
  if (y > mid) modify(rt << 1 | 1, mid + 1, r, x, y, z);
}
int fa[MAXN], g[MAXN], sz[MAXN];
std::pair<int, int> dx[MAXN], dy[MAXN];
int vis[MAXN];
bool ans[MAXN];
std::pair<int, int> find(int x) {
  if (fa[x] == x) return std::make_pair(x, 0);
  std::pair<int, int> ret = find(fa[x]);
  ret.second ^= g[x];
  return ret;
}
inline bool unin(const int id) {
  const int x = u[id], y = v[id];
  const std::pair<int, int> xx = find(x), yy = find(y);
  dx[id] = xx;
  dy[id] = yy;
  if (xx.first == yy.first)
    return xx.second != yy.second;
  else {
    const int val = (xx.second == yy.second);
    if (sz[xx.first] > sz[yy.first]) {
      fa[yy.first] = xx.first;
      g[yy.first] = val;
      sz[xx.first] += sz[yy.first];
      vis[id] = 1;
    } else {
      fa[xx.first] = yy.first;
      g[xx.first] = val;
      sz[yy.first] += sz[xx.first];
      vis[id] = -1;
    }
    return 1;
  }
}
inline void undo(const int id) {
  if (!vis[id]) return;
  const std::pair<int, int> xx = dx[id], yy = dy[id];
  if (vis[id] > 0) {
    fa[yy.first] = yy.first;
    g[yy.first] = 0;
    sz[xx.first] -= sz[yy.first];
    vis[id] = 0;
  } else {
    fa[xx.first] = xx.first;
    g[xx.first] = 0;
    sz[yy.first] -= sz[xx.first];
    vis[id] = 0;
  }
}
void dfs(int rt, int l, int r) {
  std::vector<int> p;
  while (!t[rt].empty()) {
    const int x = t[rt].back();
    t[rt].pop_back();
    p.push_back(x);
    if (!unin(x)) {
      while (!p.empty()) {
        undo(p.back());
        p.pop_back();
      }
      return;
    }
  }
  if (l == r) {
    ans[l] = 1;
    while (!p.empty()) {
      undo(p.back());
      p.pop_back();
    }
    return;
  }
  int mid = (l + r) >> 1;
  dfs(rt << 1, l, mid);
  dfs(rt << 1 | 1, mid + 1, r);
  while (!p.empty()) {
    undo(p.back());
    p.pop_back();
  }
}
signed main() {
  read(n, m);
  for (int i = (1), iEND = (m); i <= iEND; ++i) {
    int x, y;
    read(x, y);
    const std::pair<int, int> tt = std::make_pair(x, y);
    if (f.find(tt) == f.end()) {
      f[tt] = ++tot;
      u[tot] = x;
      v[tot] = y;
    }
    int w = f[tt];
    if (!lst[w])
      lst[w] = i;
    else
      modify(1, 1, m, lst[w], i - 1, w), lst[w] = 0;
  }
  for (int i = (1), iEND = (tot); i <= iEND; ++i)
    if (lst[i]) modify(1, 1, m, lst[i], m, i);
  for (int i = (1), iEND = (n); i <= iEND; ++i) fa[i] = i, sz[i] = 1;
  dfs(1, 1, m);
  for (int i = (1), iEND = (m); i <= iEND; ++i) print(ans[i] ? "YES" : "NO");
}
