#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

bool solve(){
    vector<int> cnt(15);
    vector<int> a(6);
    for (auto &&i : a) scanf("%d", &i), cnt[i]++;
    for (int i = 1; i <= 13; ++i) {
        if(i != 7 && !cnt[i]) cnt[i] = -1;
    }
    if(cnt[1] == cnt[13]){
        return cnt[1] != 1;
    }
    int l = 7, r = 7, cnt1 = 0, cnt2 = 0;
    if(cnt[1] == 1){
        while(true){
            if(cnt[l-1] == 1) l--, cnt[l] = 0, cnt1++;
            else if(cnt[r+1] == 1) r++, cnt[r] = 0, cnt1++;
            if(cnt1 == 6) return true;
            if(cnt[r+1] == -1) r++, cnt[r] = 0, cnt2++;
            else if(cnt[l-1] == -1) l--, cnt[l] = 0, cnt2++;
            if(cnt2 == 6) return false;
        }
    }else {
        while(true){
            if(cnt[r+1] == 1) r++, cnt[r] = 0, cnt1++;
            else if(cnt[l-1] == 1) l--, cnt[l] = 0, cnt1++;
            if(cnt1 == 6) return true;

            if(cnt[l-1] == -1) l--, cnt[l] = 0, cnt2++;
            else if(cnt[r+1] == -1) r++, cnt[r] = 0, cnt2++;
            if(cnt2 == 6) return false;
        }
    }
}

int main() {
    int n;
    cin >> n;
    while(n--) {
        puts(solve() ? "yes" : "no");
    }
    return 0;
}
