#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int N;
int out_table[50][3];
map<int,bool> MAP;
bool FLG;


int makeCode(int code[3]){
	return 100*code[0]+10*code[1]+code[2];
}


void recursive(int code[3],bool used[50]){
	if(FLG)return;
	int tmp_code;

	int next_code[3];

	for(int i = 0; i < N; i++){
		if(used[i] == false){

			for(int k = 0; k < 3; k++){
				next_code[out_table[i][k]] = code[k];
			}

			tmp_code = makeCode(next_code);

			if(tmp_code == 12){
				FLG = true;
				return;
			}
			auto at = MAP.find(tmp_code);
			if(at != MAP.end())continue;
			MAP[tmp_code] = true;

			bool next_used[50];
			for(int k = 0; k < N; k++)next_used[k] = used[k];
			next_used[i] = true;
			recursive(next_code,next_used);
		}
	}

}

int main(){

	scanf("%d",&N);

	int yoko_num,work[3],tmp;

	for(int loop = 0; loop < N; loop++){
		scanf("%d",&yoko_num);

		for(int i = 0; i < 3; i++)work[i] = i;

		for(int i = 0; i < yoko_num; i++){
			scanf("%d",&tmp);
			if(tmp == 0){
				swap(work[0],work[1]);
			}else{
				swap(work[1],work[2]);
			}
		}

		for(int i = 0; i < 3; i++){
			out_table[loop][work[i]] = i;
		}
	}

	FLG = false;
	int first_code[3] = {0,1,2};
	bool first_used[50];
	for(int i = 0; i < N; i++)first_used[i] = false;

	recursive(first_code,first_used);

	if(FLG){
		printf("yes\n");
	}else{
		printf("no\n");
	}

	return 0;
}

