object Main extends App {

  import scala.io.StdIn._

  val n = readLine.trim.toInt
  for (_ ← 0 until n){
    val first = readLine.trim.split(' ').map(_.toInt)
    if (canWin(Hand(first), Hand((1 to 13).filterNot(p ⇒ first.contains(p)).toArray))) {
      println("yes")
    }else{
      println("no")
    }
  }
  def canWin(first: Hand, second: Hand): Boolean = {
    val memo = Array.tabulate(7){_ ⇒ Array.tabulate(7){_ ⇒ None: Option[Boolean]}}
    def sub(first: Hand, second: Hand, gameState: GameState): Boolean = {
      if (second.isEmpty) false
      else {
        memo(7 - gameState.left)(gameState.right - 7) match {
          case Some(r) ⇒ r
          case None ⇒
           first.next (gameState).exists {case (nextFirst, game) ⇒ nextFirst.isEmpty || second.next (game).forall { case (nextSecond, g) ⇒ sub (nextFirst, nextSecond, g)}}.also(b ⇒ memo(7 - gameState.left)(gameState.right - 7) = Some(b))
        }
      }
    }
    sub(first, second, GameState())
  }
  case class GameState(left: Int = 7, right: Int = 7) {
    def isEnd: Boolean = left == 1 && right == 13
  }
  object Hand {
    def apply(array: Array[Int]): Hand = {
      Hand(array.filter(_ < 7).sorted.reverse.toList, array.filter(_ > 7).sorted.toList)
    }
  }
  case class Hand(left: List[Int], right: List[Int]) {
    def next(gameState: GameState): List[(Hand, GameState)] = {
      List(left match {
        case h::t if h + 1 == gameState.left ⇒ List((Hand(t, right), GameState(h, gameState.right)))
        case _ ⇒ Nil
      }, right match {
        case h::t if h - 1 == gameState.right ⇒ List((Hand(left, t), GameState(gameState.left, h)))
        case _ ⇒ Nil
      }
      ).flatten match {
        case Nil ⇒ List((this, gameState))
        case l ⇒ l
      }
    }
    def isEmpty: Boolean = left.isEmpty && right.isEmpty
  }
  implicit class Extension[T](value :T){
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
    @inline
    def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}
