#include #include #include #include using namespace std; #define CIN( LL , A ) LL A; cin >> A #define UNTIE ios_base::sync_with_stdio( false ); cin.tie( nullptr ) #define FOR( VAR , INITIAL , FINAL_PLUS_ONE ) for( remove_const::type >::type VAR = INITIAL ; VAR < FINAL_PLUS_ONE ; VAR ++ ) #define REPEAT( HOW_MANY_TIMES ) FOR( VARIABLE_FOR_REPEAT , 0 , HOW_MANY_TIMES ) #define QUIT return 0 #define RETURN( ANSWER ) cout << ( ANSWER ) << "\n"; QUIT #include #define MAIN main int MAIN() { UNTIE; constexpr const int bound_N = 11; CIN( int , N ); assert( 0 <= N && N < bound_N ); constexpr const int bound_M = 1024; int ambient = ( 1 << N ) - 1; CIN( int , M ); assert( 0 <= M && M <= ambient ); bool O[bound_M] = {}; int U[bound_M]; int Lm; int Ai; FOR( m , 0 , M ){ int& Um = U[m]; Um = 0; cin >> Lm; assert( Lm > 0 ); REPEAT( Lm ){ cin >> Ai; assert( ( Um & ( 1 << Ai ) ) == 0 ); Um |= 1 << Ai; } assert( ! O[Um] ); O[Um] = true; } bool searching; FOR( n0 , 1 , N ){ FOR( n1 , 0 , n0 ){ searching = true; FOR( m , 0 , M ){ if( ( ( U[m] >> n0 ) & 1 ) != ( ( U[m] >> n1 ) & 1 ) ){ searching = false; break; } } if( searching ){ RETURN( "No" ); } } } RETURN( "Yes" ); }