#include<bits/stdc++.h>
using namespace std;

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

vector<int> f(6), g;
int memo[15][15][2];

int solve(int left, int right, int turn, int sen, int go){
    if(sen == 0){
        return 0;
    }
    if(go == 0){
        return 1;
    }
    if(memo[left][right][turn] >= 0){
        return memo[left][right][turn];
    }

    bool res = false, flag = false;
    if(turn == 0){
        rep(i, 6){
            if(f[i] == left - 1){
                res |= solve(left - 1, right, 1, sen - 1, go) == 0;
                flag = true;
            }else if(f[i] == right + 1){
                res |= solve(left, right + 1, 1, sen - 1, go) == 0;
                flag = true;
            }
        }
        if(!flag){
            res |= solve(left, right, 1, sen, go) == 0;
        }
    }else{
        rep(i, 6){
            if(g[i] == left - 1){
                res |= solve(left - 1, right, 0, sen, go - 1) == 1;
                flag = true;
            }else if(g[i] == right + 1){
                res |= solve(left, right + 1, 0, sen, go - 1) == 1;
                flag = true;
            }
        }
        if(!flag){
            res |= solve(left, right, 0, sen, go) == 1;
        }
    }

    if(res){
        return memo[left][right][turn] = turn;
    }else{
        return memo[left][right][turn] = turn ^ 1;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    rep(I, n){
        rep(i, 6){
            cin >> f[i];
        }
        g.clear();
        reps(i, 13){
            if(i == 7){
                continue;
            }
            bool flag = true;
            rep(j, 6){
                if(f[j] == i){
                    flag = false;
                }
            }
            if(flag){
                g.emplace_back(i);
            }
        }
        memset(memo, -1, sizeof(memo));
        if(solve(7, 7, 0, 6, 6) == 0){
            cout << "yes" << endl;
        }else{
            cout << "no" << endl;
        }
    }

    return 0;
}
