#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <iostream>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
using namespace std;

enum Type{
	None,
	Sente,
	Enemy,
	Location
};

struct Info{
	Type next;
	Type cards[15];
};

bool calc(Info info){

	int candidate_left = -1,candidate_right = -1;

	if(info.next == Sente){

		int enemy_num = 0;

		for(int i = 1; i <= 13; i++){
			if(info.cards[i] == Enemy)enemy_num++;
		}

		if(enemy_num == 0)return false;

		for(int i = 1; i <= 13; i++){
			if(info.cards[i] == Location){
				if(info.cards[i-1] == Sente){
					candidate_left = i-1;
				}
				break;
			}
		}

		for(int i = 13; i >= 1; i--){
			if(info.cards[i] == Location){
				if(info.cards[i+1] == Sente){
					candidate_right = i+1;
				}
				break;
			}
		}

		if(candidate_left != -1 && candidate_right != -1){

			Info new_info;
			for(int i = 0; i <= 14; i++)new_info.cards[i] = info.cards[i];
			new_info.cards[candidate_left] = Location;
			new_info.next = Enemy;

			Info new_info1;
			for(int i = 0; i <= 14; i++)new_info1.cards[i] = info.cards[i];
			new_info1.cards[candidate_right] = Location;
			new_info1.next = Enemy;

			return calc(new_info)||calc(new_info1);

		}else if(candidate_left == -1 && candidate_right == -1){

			Info new_info;
			for(int i = 0; i <= 14; i++)new_info.cards[i] = info.cards[i];
			new_info.next = Enemy;

			return calc(new_info);

		}else if(candidate_left != -1){

			Info new_info;
			for(int i = 0; i <= 14; i++)new_info.cards[i] = info.cards[i];
			new_info.cards[candidate_left] = Location;
			new_info.next = Enemy;

			return calc(new_info);

		}else{
			Info new_info;
			for(int i = 0; i <= 14; i++)new_info.cards[i] = info.cards[i];
			new_info.cards[candidate_right] = Location;
			new_info.next = Enemy;

			return calc(new_info);
		}

	}else{

		int sente_num = 0;

		for(int i = 1; i <= 13; i++){
			if(info.cards[i] == Sente)sente_num++;
		}

		if(sente_num == 0)return true;

		for(int i = 1; i <= 13; i++){
			if(info.cards[i] == Location){
				if(info.cards[i-1] == Enemy){
					candidate_left = i-1;
				}
				break;
			}
		}

		for(int i = 13; i >= 1; i--){
			if(info.cards[i] == Location){
				if(info.cards[i+1] == Enemy){
					candidate_right = i+1;
				}
				break;
			}
		}

		if(candidate_left != -1 && candidate_right != -1){

			Info new_info;
			for(int i = 0; i <= 14; i++)new_info.cards[i] = info.cards[i];
			new_info.cards[candidate_left] = Location;
			new_info.next = Sente;

			Info new_info1;
			for(int i = 0; i <= 14; i++)new_info1.cards[i] = info.cards[i];
			new_info1.cards[candidate_right] = Location;
			new_info1.next = Sente;

			return calc(new_info)&&calc(new_info1);

		}else if(candidate_left == -1 && candidate_right == -1){

			Info new_info;
			for(int i = 0; i <= 14; i++)new_info.cards[i] = info.cards[i];
			new_info.next = Sente;

			return calc(new_info);

		}else if(candidate_left != -1){

			Info new_info;
			for(int i = 0; i <= 14; i++)new_info.cards[i] = info.cards[i];
			new_info.cards[candidate_left] = Location;
			new_info.next = Sente;

			return calc(new_info);

		}else{

			Info new_info;
			for(int i = 0; i <= 14; i++)new_info.cards[i] = info.cards[i];
			new_info.cards[candidate_right] = Location;
			new_info.next = Sente;

			return calc(new_info);
		}
	}
}

void func(){

	int tmp;
	Info first;

	for(int i = 1; i <= 13; i++){
		first.cards[i] = Enemy;
	}

	for(int i = 0; i < 6; i++){
		scanf("%d",&tmp);
		first.cards[tmp] = Sente;
	}

	first.cards[0] = None;
	first.cards[7] = Location;
	first.cards[14] = None;

	first.next = Sente;

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

int main(){

	int N;
	scanf("%d",&N);

	for(int loop = 0; loop < N; loop++){
		func();
	}

	return 0;
}

Measured memory_bytes: 3156