#include using namespace std; int main() { int N; cin >> N; vector> E(N); for (int i = 0; i < N; i++) { int M; cin >> M; for (int j = 0; j < M; j++) { int A; cin >> A; A--; E[i].push_back(A); } } vector used(N, false); queue Q; Q.push(0); while (!Q.empty()) { int v = Q.front(); used[v] = true; Q.pop(); for (int w : E[v]) { if (!used[w]) { used[w] = true; Q.push(w); } } } bool ok = true; for (int i = 0; i < N; i++) { if (!used[i]) ok = false; } cout << (ok ? "Yes" : "No") << endl; }