#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

int a[6], b[6];
bool saiki(int x, int y,int min,int max,bool z) {
	if (x == 0)return true;
	if (y == 0)return false;
	if (z) {
		bool P = false;
		bool n = true;
		for (int i = 0; i < 6; i++) {
			if (a[i] + 1 == min) {
				n = false;
				P=P||saiki(x - 1, y, min - 1, max, false);
			}
			else if (a[i] - 1 == max) {
				n = false;
				P=P||saiki(x - 1, y, min, max+1, false);
			}
		}
		if (n)P=P||saiki(x, y, min, max, false);
		return P;
	}
	else {
		bool Q = true;
		bool m = true;
		for (int i = 0; i < 6; i++) {
			if (b[i] + 1 == min) {
				m = false;
				Q=Q&&saiki(x, y-1, min - 1, max, true);
			}
			else if (b[i] - 1 == max) {
				m = false;
				Q = Q&&saiki(x, y-1, min, max + 1, true);
			}
		}
		if (m)Q = Q&&saiki(x, y, min, max, true);
		return Q;
	}
	return true;
}
int main() {
	int e; cin >> e;
	for (int f = 0; f < e; f++) {
		for (int g = 0; g < 6; g++) {
			cin >> a[g];
		}
		int sum = 0;
		for (int h = 1; h < 14; h++) {
			if (h != 7) {
				bool k = true;
				for (int i = 0; i < 6; i++) {
					if (a[i] == h)k = false;
				}
				if (k) {
					b[sum] = h;
					sum++;
				}
			}
		}
		if (saiki(6, 6, 7, 7, true))puts("yes");
		else puts("no");
	}
}