#include <bits/stdc++.h>

using namespace std;

using i64 = int64_t;
const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;

signed main(){
    int N;
    cin >> N;
    for(int i = 0;i < N;i++){
        bitset<13> v;
        for(int j = 0;j < 6;j++){
            int a;cin >> a;
            a--;
            v[a] = true;
        }
        bitset<13> v1;
        for(int i = 0;i < 13;i++){
            if(i == 6)continue;
            if(!v[i]){
                v1[i] = true;
            }
        }
        std::function<bool(bool, bitset<13>, bitset<13>, bitset<13>)> uku = [&](bool turn, bitset<13> f, bitset<13> mika, bitset<13> aite){
            if(f.all()){
                return !turn;
            }

            if(turn){
                bool r = true;
                bool win = true;
                for(int i = 0;i < 12;i++){
                    if(f[i] && !f[i+1]){
                        if(mika[i+1]){
                            mika[i+1] = false;
                            f[i+1] = true;
                            win = win & uku(!turn, f, mika, aite);
                            mika[i+1] = true;
                            f[i+1] = false;
                            r = false;
                        }
                    }
                }
                for(int i = 12;i >= 1;i--){
                    if(f[i] && !f[i-1]){
                        if(mika[i-1]){
                            mika[i-1] = false;
                            f[i-1] = true;
                            win = win & uku(!turn, f, mika, aite);
                            mika[i-1] = true;
                            f[i-1] = false;
                            r = false;
                        }
                    }
                }
                if(r){
                    win = win & uku(!turn, f, mika, aite);
                }
                return win;
            }else{
                bool r = true;
                bool win = false;

                for(int i = 0;i < 12;i++){
                    if(f[i] && !f[i+1]){
                        if(aite[i+1]){
                            aite[i+1] = false;
                            f[i+1] = true;
                            win = win | uku(!turn, f, mika, aite);
                            aite[i+1] = true;
                            f[i+1] = false;
                            r = false;
                        }
                    }
                }
                for(int i = 12;i >= 1;i--){
                    if(f[i] && !f[i-1]){
                        if(aite[i-1]){
                            aite[i-1] = false;
                            f[i-1] = true;
                            win = win | uku(!turn, f, mika, aite);
                            aite[i-1] = true;
                            f[i-1] = false;
                            r = false;
                        }
                    }
                }
                if(r){
                    win = win | uku(!turn, f, mika, aite);
                }
                return win;
            }
        };
        bitset<13> f;
        f[6] = 1;
        bool win = uku(true, f, v, v1);
        cout<<(!win ? "yes" : "no")<<endl;
    }
}



Measured memory_bytes: 3080