|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|5 초||512 MB||1||1||1||100.000%|
In SmurfLand there are $n$ Smurf villages and $m$ roads connecting them. Each road can be used to transport goods only in one direction. Some roads may lead from some village to itself and there might be more than one road connecting a pair of villages. The Smurfs have developed trade unions. Each trade union is a maximal subset of villages with the property that it is possible to transport goods from any village to any other village inside that trade union. Gargamel is planning to destroy one of the villages. It would be a disaster if after the village is destroyed the number of trade unions would have to increase. Help Smurfs decide which villages will need to be protected to ensure that the disaster doesn't happen.
The first line of input contains two integers $n$ and $m$ ($1 \leq n \leq 2\cdot 10^5$, $1 \leq m \leq 5\cdot 10^5$) -- the number of villages and roads. The next $m$ lines describe the roads: each line contains two integers $u, v$ ($1 \leq u,v \leq n$) specifying that there is a road directly connecting villages with numbers $u$ and $v$.
Ouput $n$ lines: $i$th line should contain the word "YES" (without quotes) if Smurfs must protect $i$th village or the word "NO" otherwise.
7 9 1 2 3 1 2 3 1 3 3 5 3 4 4 1 5 6 6 5
YES NO YES NO NO NO NO