You are given a bidirectional graph. Please check whether this graph contains any cycles. A cycle is defined as a path where the starting and ending nodes are the same, contains at least one edge, and all nodes on the path are unique (except the starting and ending nodes).
Input Specification
The first line will contain two integer, .
The next lines will each contain two integers, . It is guaranteed the graph is completely connected. However, there may be multiple edges between any distinct nodes.
Output Specification
Print YES
if there is a cycle, and NO
otherwise.
Subtasks
Subtask 1 [50%]
Subtask 2 [50%]
No further constraints.
Sample Input 1
4 4
1 2
2 1
2 3
3 4
Sample Output 1
YES
Sample Input 2
4 3
1 2
2 3
2 4
Sample Output 2
NO
Comments
bruh
bruh