Problem Statement
An undirected graph with numbered vertices is called a good graph if it has a spanning tree $T$ that satisfies the following condition. Here, an edge connecting two vertices $u$ and $v$ $(u < v)$ is denoted as edge $(u,v)$.
- For every edge
$(u,v)$$(u < v)$in the graph, the minimum and maximum vertex numbers on the unique simple path connecting vertices$u$and$v$in$T$are$u$and$v$, respectively.
You are given a simple connected undirected graph $G$ with $N$ vertices numbered from $1$ to $N$. The graph $G$ has $M$ edges, and the $i$-th edge connects vertices $A_i$ and $B_i$ $(A_i < B_i)$.
For each $i=1,2,\dots,M$, determine whether the graph obtained by removing the $i$-th edge from $G$ is a good graph.
Constraints
$2 \leq N \leq 2 \times 10^5$$N-1 \leq M \leq 2 \times 10^5$$1 \leq A_i < B_i \leq N$- All input values are integers.
- The given graph is a simple connected undirected graph.
Input
The input is given from Standard Input in the following format:
N M
A_1 B_1
\vdots
A_M B_M
Output
Print $M$ lines. The $i$-th line should contain Yes if the graph obtained by removing the $i$-th edge from $G$ is a good graph, and No otherwise.
样例
6 9
1 3
1 5
2 5
2 6
3 4
3 5
3 6
4 6
5 6
No
No
No
No
Yes
No
No
Yes
Yes
5 4
1 2
2 3
3 4
4 5
No
No
No
No
15 20
12 13
7 8
5 7
8 10
9 12
4 5
11 12
2 4
6 8
4 14
1 2
14 15
2 9
3 8
2 15
10 11
13 14
8 9
7 14
5 13
No
No
No
Yes
Yes
No
Yes
No
No
No
No
No
No
No
No
Yes
No
No
No
No
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。