- Time limit: 1.00 s
- Memory limit: 512 MB
Given an undirected graph, your task is to find out if there is a node that belongs to more than one cycle.
Input
The first input line has an integer : the number of tests. Then each test has the following format:
The first line has two integers and : the number of nodes and edges. The nodes are numbered .
Then there are lines that describe the edges. Each line has two distinct integers and : there is an edge between nodes and .
You can assume that there is at most one edge between two nodes.
Output
For each test, print "YES", if there is a node that belongs to more than one cycle, and "NO" otherwise.
Constraints
Example
Input:
2 4 4 1 2 1 3 1 4 2 3 4 5 1 2 1 3 1 4 2 3 3 4
Output:
NO YES