#D5319. DAG Trio (Hard)
DAG Trio (Hard)
DAG Trio (Hard)
This issue is the same configuration issue as D: DAG Trio (Easy), with only the constraints being different.
input
output
Print "YES" or "NO" on the line.
Example
Input
3 3 1 2 2 3 3 1
Output
YES
inputFormat
input
outputFormat
output
Print "YES" or "NO" on the line.
Example
Input
3 3 1 2 2 3 3 1
Output
YES
样例
3 3
1 2
2 3
3 1
YES