4179: Bipartite Checking

内存限制:256 MB 时间限制:2 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

time limit per test
6 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
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<yin). 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

输入样例 复制


输出样例 复制