- 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 t: the number of tests. Then each test has the following format:
The first line has two integers n and m: the number of nodes and edges. The nodes are numbered 1,2,\dots,n.
Then there are m lines that describe the edges. Each line has two distinct integers a and b: there is an edge between nodes a and b.
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
- 1 \le t \le 1000
- 1 \le n, m \le 100
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