#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--){ int K,M,N; cin >> K >> M >> N; M--; if(M == 0){cout << "No\n"; continue;} vector> Graph(K); for(int i=0; i already(K); vector answer; for(int i=0; i Q; Q.push(i); bool ok = true; while(Q.size()){ int pos = Q.front(); Q.pop(); if(ok) answer.push_back(pos),ok = false; else ok = true; for(auto to : Graph.at(pos)){ if(already.at(to)){ if(ok == false) answer.pop_back(); break; } Q.push(to); already.at(to) = true; } } } while(answer.size() > N) answer.pop_back(); if(answer.size() < N) cout << "No\n"; else{ cout << "Yes\n"; for(int i=0; i