(Smurf)Land protection

아직 제출이 없습니다시간 제한5초메모리 제한512 MB

문제

In SmurfLand there are nn Smurf villages and mm 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 nn and mm (1n21051 \leq n \leq 2\cdot 10^5, 1m51051 \leq m \leq 5\cdot 10^5) -- the number of villages and roads.  The next mm lines describe the roads: each line contains two integers u,vu, v (1u,vn1 \leq u,v \leq n) specifying that there is a road directly connecting villages with numbers uu and vv.

출력

Ouput nn lines: iith line should contain the word "YES" (without quotes) if Smurfs must protect iith village or the word "NO" otherwise.