#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;


bool solve() {
    int n;
    cin >> n;

    VV<int> ls;
    map<V<int>, int> mp;
    for (int i = 0; i < n; i++) {
        int w;
        cin >> w;
        V<int> v(3);
        iota(begin(v), end(v), 0);
        for (int j = 0; j < w; j++) {
            int a;
            cin >> a;
            swap(v[2*a], v[1]);
        }
        ls.push_back(v);
        mp[v]++;
        if (v == V<int>{0, 1, 2}) return true;
        if (v == V<int>{1, 0, 2} && mp[v] >= 2) return true;
        if (v == V<int>{0, 2, 1} && mp[v] >= 2) return true;
        if (v == V<int>{2, 1, 0} && mp[v] >= 2) return true;
        if (mp[v] >= 3) return true;
    }
    sort(begin(ls), end(ls));
    do {
        V<int> v(3), v2(3);
        iota(begin(v), end(v), 0);
        for (auto &w: ls) {
            for (int i = 0; i < 3; i++) {
                v2[w[i]] = v[i];
            }
            for (int i = 0; i < 3; i++) {
                v[i] = v2[i];
            }
            if (v == V<int>{0, 1, 2}) return true;
        }

    } while (next_permutation(begin(ls), end(ls)));
    return false;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);

    if (solve()) {
        cout << "yes" << endl;
    } else {
        cout << "no" << endl;
    }

    return 0;

}

