Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official.
×

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

F. Bipartite Checking

time limit per test

6 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou 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. *i*th line contains two numbers *x*_{i} and *y*_{i} (1 ≤ *x*_{i} < *y*_{i} ≤ *n*). These numbers describe *i*th query: if there is an edge between vertices *x*_{i} and *y*_{i}, then remove it, otherwise add it.

Output

Print *q* lines. *i*th line must contain YES if the graph is bipartite after *i*th query, and NO otherwise.

Example

Input

3 5

2 3

1 3

1 2

1 2

1 2

Output

YES

YES

NO

YES

NO

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/14/2018 14:26:38 (d3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|