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
/**
 * Created by Aminul on 7/21/2018.
 */

import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class CF813F {
    static PrintWriter pw = new PrintWriter(System.out);
    public static void main(String[] args)throws Exception {
        FastReader in = new FastReader(System.in);
        int n = in.nextInt(), m = in.nextInt();
        dsu = new DSU_withRollback(n);
        TreeMap<Edge, Integer> map = new TreeMap<>();
        List<Edge> g = new ArrayList<>();
        for (int i = 1; i <= m; i++) {
            int u = in.nextInt(), v = in.nextInt();
            if(u > v){ int tmp = u; u = v; v = tmp;}
            Edge e = new Edge(u, v);
            if(map.containsKey(e)){
                e.l = map.get(e);
                e.r = i;
                g.add(e);
                map.remove(e);
            }
            else{
                e.l = i;
                map.put(e, i);
            }
        }

        for(Edge e : map.keySet()){
            e.r = m+1;
            g.add(e);
        }

        solve(1, m, g);

        pw.close();
    }

    static DSU_withRollback dsu;

    static void solve(int l, int r, List<Edge> g){
        int k = dsu.stack.size(); //debug(l, r, k);
        List<Edge> temp = new ArrayList<>();
        for (Edge e : g) {
            if(e.l <= l && e.r > r){
                 dsu.union(e.u, e.v);
            }
            else if(e.l <= r &&  e.r > l) temp.add(e);
        }

        if(l == r){
            if(dsu.isBipartite()) pw.println("YES");
            else pw.println("NO");
        }
        else {
            int m = (l + r) / 2;
            solve(l, m, temp);
            solve(m + 1, r, temp);
        }
        dsu.rollback(k);
    }

    static class DSU_withRollback{
        int [] parent, size, dist; // dist = dist of node from parent/leader of group
        int numViolations; //if numViolations = 0, then graph is bipartite
        Stack<int[]> stack;

        DSU_withRollback(int n){
            parent = new int[n+1];
            size = new int[n+1];
            dist = new int[n+1];
            stack = new Stack<>();
            numViolations = 0;
            for (int i = 0; i <= n; i++) {
                parent[i] = i; dist[i] = 1;
            }
        }

        boolean isBipartite(){
            return numViolations == 0;
        }

        int[] find(int u) {
            int d = 0;
            while(parent[u] != u){
                d += dist[u];
                u = parent[u];
            }
            return new int[]{u, d};
        }

        void union(int u, int v) {
            if(!isBipartite()) return;
            int[] x = find(u), y = find(v);

            if(x[0] == y[0]) {
                int d = x[1] + y[1];
                if((d & 1) == 0) {
                    numViolations++;
                    stack.push(new int[]{-1, -1});
                }
                else{
                    stack.push(new int[]{x[0], y[0]});
                }
            } else {
                u = x[0]; v = y[0];
                if(size[u] > size[v]) {
                    int tmp = u; u = v; v = tmp;
                }
                parent[u] = v;
                size[v] += size[u];
                dist[u] = x[1] + y[1] + 1;
                stack.push(new int[]{u, v});
            }
        }

        void rollback(int time) {
            while(stack.size() > time) {
                rollback();
            }
        }

        void rollback() {
            int it[] = stack.pop();
            if(it[0] == -1) numViolations--;
            else {
                parent[it[0]] = it[0];
                dist[it[0]] = 0;
                size[it[1]] -= size[it[0]];
            }
        }
    }

    static class DSUWithRollbacks {
        int[] p;
        int[] size;
        boolean[] sameColAsParent;
        List<Integer> changes = new ArrayList<>();
        int numViolations = 0;



        DSUWithRollbacks(int n) {
            p = new int[n];
            size = new int[n];
            sameColAsParent = new boolean[n];
            for (int i = 0; i < n; i++) {
                p[i] = i;
                size[i] = 1;
            }
        }

        boolean isBipartite(){
            return numViolations == 0;
        }

        int getComp(int x) {
            while (x != p[x]) {
                x = p[x];
            }
            return x;
        }

        boolean col(int x) {
            if (x == p[x]) {
                return false;
            }
            return col(p[x]) ^ sameColAsParent[x];
        }

        void union(int a, int b) {
            int ca = getComp(a);
            int cb = getComp(b);
            if (size[ca] > size[cb]) {
                int t = ca;
                ca = cb;
                cb = t;
                t = a;
                a = b;
                b = t;
            }

            boolean same = col(a) == col(b);
            changes.add(ca);
            changes.add(cb);
            changes.add(p[ca]);
            changes.add(size[cb]);
            changes.add(same ? 1 : 0);
            if (ca == cb) {
                if (same) {
                    ++numViolations;
                }
                return;
            }
            p[ca] = cb;
            sameColAsParent[ca] = same;
            size[cb] += size[ca];
        }

        void rollback() {
            int ca = changes.get(changes.size() - 5);
            int cb = changes.get(changes.size() - 4);
            int pa = changes.get(changes.size() - 3);
            int sb = changes.get(changes.size() - 2);
            boolean same = changes.get(changes.size() - 1) == 1;
            for (int i = 0; i < 5; i++) {
                changes.remove(changes.size() - 1);
            }

            if (ca == cb) {
                if (same) {
                    --numViolations;
                }
                return;
            }
            p[ca] = pa;
            sameColAsParent[ca] = same;
            size[cb] = sb;
        }

    }


    static class Edge implements Comparable<Edge> {
        int u, v, l, r;

        Edge(int F, int S) {
            u = F; v = S;
        }

        Edge(int F, int S, int L, int R) {
            u = F;v = S; l = L; r = R;
        }

        public int compareTo(Edge p) {
            if (u == p.u) return v - p.v;
            return u - p.u;
        }

        public String toString() {
            return u + " " + v+" "+l+" "+r;
        }
    }

    static void deb(Stack<int[]> st){
        StringBuilder sb = new StringBuilder();
        for(int a[]: st) sb.append(a[0]+" "+a[1]+", ");
        debug(sb);
    }

    static void debug(Object...obj) {
        System.err.println(Arrays.deepToString(obj));
    }

    static class FastReader {
        InputStream is;
        private byte[] inbuf = new byte[1024];
        private int lenbuf = 0, ptrbuf = 0;
        static final int ints[] = new int[128];

        public FastReader(InputStream is){
            for(int i='0';i<='9';i++) ints[i]=i-'0';
            this.is = is;
        }

        public int readByte(){
            if(lenbuf == -1)throw new InputMismatchException();
            if(ptrbuf >= lenbuf){
                ptrbuf = 0;
                try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
                if(lenbuf <= 0)return -1;
            }
            return inbuf[ptrbuf++];
        }

        public boolean isSpaceChar(int c) {
            return !(c >= 33 && c <= 126);
        }
        public int skip() {
            int b;
            while((b = readByte()) != -1 && isSpaceChar(b));
            return b;
        }

        public String next(){
            int b = skip();
            StringBuilder sb = new StringBuilder();
            while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public int nextInt(){
            int num = 0, b;
            boolean minus = false;
            while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
            if(b == '-'){
                minus = true;
                b = readByte();
            }

            while(true){
                if(b >= '0' && b <= '9'){
                    num = (num<<3) + (num<<1) + ints[b];
                }else{
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

        public long nextLong() {
            long num = 0;
            int b;
            boolean minus = false;
            while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
            if(b == '-'){
                minus = true;
                b = readByte();
            }

            while(true){
                if(b >= '0' && b <= '9'){
                    num = (num<<3) + (num<<1) + ints[b];
                }else{
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
       /* public char nextChar() {
            return (char)skip();
        }*/

        public char[] next(int n){
            char[] buf = new char[n];
            int b = skip(), p = 0;
            while(p < n && !(isSpaceChar(b))){
                buf[p++] = (char)b;
                b = readByte();
            }
            return n == p ? buf : Arrays.copyOf(buf, p);
        }

        /*private char buff[] = new char[1005];
        public char[] nextCharArray(){
            int b = skip(), p = 0;
            while(!(isSpaceChar(b))){
                buff[p++] = (char)b;
                b = readByte();
            }
            return Arrays.copyOf(buff, p);
        }*/
    }
}