#include using namespace std; int N; bool ans = false; vector> To; vector seen(100001, false); void dfs(int v, int l) { if(l == N) { ans = true; return; } seen.at(v) = true; for(int next_v : To.at(v)) { if(seen.at(next_v)) { continue; } dfs(next_v, l + 1); } seen.at(v) = false; } int main() { cin >> N; int M; To.assign(N + 1, vector(0, 0)); for(int i = 1; i <= N; i++) { cin >> M; int A; for(int j = 0; j < M; j++) { cin >> A; To.at(i).push_back(A); } } dfs(1, 1); if(ans) { cout << "Yes" << endl; } else { cout << "No" << endl; } }