#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

bool solve(vector<int> a,int l,int r,int p,int ls,int yuki,int teki){
  //cout<<l<<" "<<r<<" "<<p<<endl;
  if(yuki==6) return true;
  if(teki==6) return false;
  if(p==0){
    if(ls==0){
      if(a[l]==0) return solve(a,l-1,r,1,ls,yuki+1,teki);
      else if(a[r]==0) return solve(a,l,r+1,1,ls,yuki+1,teki);
      else return solve(a,l,r,1,ls,yuki,teki);
    }else{
      if(a[r]==0) return solve(a,l,r+1,1,ls,yuki+1,teki);
      else if(a[l]==0) return solve(a,l-1,r,1,ls,yuki+1,teki);
      else return solve(a,l,r,1,ls,yuki,teki);
    }
  }else{
     if(ls!=0){
      if(a[l]==1) return solve(a,l-1,r,0,ls,yuki,teki+1);
      else if(a[r]==1) return solve(a,l,r+1,0,ls,yuki,teki+1);
      else return solve(a,l,r,0,ls,yuki,teki);
    }else{
      if(a[r]==1) return solve(a,l,r+1,0,ls,yuki,teki+1);
      else if(a[l]==1) return solve(a,l-1,r,0,ls,yuki,teki+1);
      else return solve(a,l,r,0,ls,yuki,teki);
    }
  }
}
    

signed main(){
  cin.tie(0);	
  // ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int a;
  rep(i,n){
    vector<int> vv={-1,1,1,1,1,1,1,1,1,1,1,1,1,1,-1};
    rep(j,6){
      cin>>a;
      vv[a]=0;
    }
    if(vv[1]==vv[13]){
      if(vv[1]==0) cout<<"no"<<endl;
      else cout<<"yes"<<endl;
    }else{
      // cout<<"?"<<endl;
      if(vv[1]==0){
	if(solve(vv,6,8,0,0,0,0)) cout<<"yes"<<endl;
	else cout<<"no"<<endl;
      }else{
	if(solve(vv,6,8,0,1,0,0)) cout<<"yes"<<endl;
	else cout<<"no"<<endl;
      }
    }
  }
  
    

  return 0;
}

