#include #include #include using namespace std; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; #define rep(i,n) for(int i=0; i<(n); i++) int main(){ int T; cin >> T; while(T--){ int N; cin >> N; vector> E(N); rep(i,N-1){ int u,v; cin >> u >> v; u--; v--; E[u].push_back(v); E[v].push_back(u); } int leaf_count = 0; rep(i,N) if(E[i].size() == 1) leaf_count += 1; if(leaf_count * 2 < N) cout << "No\n"; else cout << "Yes\n"; } return 0; } struct ios_do_not_sync { ios_do_not_sync() { ios::sync_with_stdio(false); cin.tie(nullptr); } } ios_do_not_sync_instance;