题目描述
This issue is the same configuration issue as D: DAG Trio (Easy), with only the constraints being different.
input
$N \ M$
$a_1 \ b_1$
$a_2 \ b_2$
$\$
$a_M \ b_M$
output
Print "YES" or "NO" on the $ 1 $ line.
Example
Input
3 3
1 2
2 3
3 1
Output
YES
输入格式
见题面
输出格式
见题面
样例输入
3 3
1 2
2 3
3 1
样例输出
YES