아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Chiaki Chain

시간 제한1초메모리 제한256 MB

요약
무향 그래프가 주어질 때, 이것이 정확히 k차 Chiaki Chain인지 판정한다. 즉 주 경로에 k개의 곁가지가 붙고 각 곁가지 끝에 길이 3부터 k+2까지의 단순 사이클이 달려 있는 그래프인지 확인한다.
난이도

보통10점 중 7점

유형
그래프, DFS, 구현
정답자
아직 제출이 없습니다

문제

Chiaki has a graph consisting of nn vertices and mm edges. Each edge connects two vertices. After a short time of research, she has realized that the graph may represents a special graph --  the kk-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 kk-th order Chiaki Chain looks slightly different. There are kk sub-chains extended from the main chain from kk different vertices. At the end of each sub-chain, there is a simple cycle with length 3,4,…,k+23,4,\dots,k+2. There is no useless vertices or edges in the kk-th order Chiaki Chain.

Chiaki would like to know whether the graph represents the kk-th order Chiaki Chain or not.

입력

There are multiple test cases. The first line of the input contains an integer TT, indicating the number of test cases. For each test case:

The first line contains three integers nn, mm and kk (1≤n,m,k≤2×1051 \le n,m, k \le 2 \times 10^5) -- the number of vertices and the number of edges in the graph and the order of Chiaki Chain.

Then followed by mm lines, each line contains two integers x_ix\_i and y_iy\_i (1≤x_i,y_i≤n1 \le x\_i, y\_i \le n) representing the vertices the ii-th edge connected.

It is guaranteed that the sum of mm in all test cases will not exceed 2×1052 \times 10^5.

출력

For each test case, output "Yes" if the graph represents the kk-th order Chiaki Chain, or "No" if not.

예제1

  1. 예제 1

    입력
    2
    20 22 3
    1 2
    2 3
    3 4
    4 5
    5 6
    2 7
    7 8
    8 9
    9 10
    10 11
    11 12
    12 8
    3 13
    13 14
    14 15
    15 16
    16 13
    5 17
    17 18
    18 19
    19 20
    20 18
    5 6 3
    1 2
    2 3
    3 4
    4 5
    5 1
    1 3
    
    예상 출력
    Yes
    No