Chiaki Chain
시간 제한1초메모리 제한256 MB
무향 그래프가 주어질 때, 이것이 정확히 k차 Chiaki Chain인지 판정한다. 즉 주 경로에 k개의 곁가지가 붙고 각 곁가지 끝에 길이 3부터 k+2까지의 단순 사이클이 달려 있는 그래프인지 확인한다.
문제
Chiaki has a graph consisting of vertices and edges. Each edge connects two vertices. After a short time of research, she has realized that the graph may represents a special graph -- the -th order Chiaki Chain.
An ordinary chain is a graph consisting of a sequential (at least two) vertices. Each two adjacent vertices are connected by an edge. The -th order Chiaki Chain looks slightly different. There are sub-chains extended from the main chain from different vertices. At the end of each sub-chain, there is a simple cycle with length . There is no useless vertices or edges in the -th order Chiaki Chain.
Chiaki would like to know whether the graph represents the -th order Chiaki Chain or not.
입력
There are multiple test cases. The first line of the input contains an integer , indicating the number of test cases. For each test case:
The first line contains three integers , and () -- the number of vertices and the number of edges in the graph and the order of Chiaki Chain.
Then followed by lines, each line contains two integers and () representing the vertices the -th edge connected.
It is guaranteed that the sum of in all test cases will not exceed .
출력
For each test case, output "Yes" if the graph represents the -th order Chiaki Chain, or "No" if not.