#include using namespace std; using ll = long long; using pll = pair; #define all(a) (a).begin(), (a).end() #define pb push_back #define fi first #define se second mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count()); const ll MOD1000000007 = 1000000007; const ll MOD998244353 = 998244353; const ll MOD[3] = {999727999, 1070777777, 1000000007}; const ll LINF = 1LL << 60LL; const int IINF = (1 << 30) - 1; void solve(){ int n, m; cin >> n >> m; ll k; cin >> k; vector> G(n); for(int i=0; i> u >> v; u--; v--; G[u].push_back(v); G[v].push_back(u); } vector b(n); for(int i=0; i> b[i]; if(k%2 == 0){ ll sumB = 0LL; for(int i=0; i c(n, -1); bool is_bipartite = true; function bipartite_coloring = [&](int v){ for(int to : G[v]){ if(c[to] == -1){ c[to] = 1 - c[v]; bipartite_coloring(to); }else if(c[to] == c[v]){ is_bipartite = false; } } }; c[0] = 0; bipartite_coloring(0); if(!is_bipartite){ cout << "Yes\n"; return; } vector sum(2, 0LL); for(int i=0; i> T; while(T--) solve(); }