import Foundation

var bingo_card: [String] = []
var numbers: [String] = []
var bingo_status: [Bool] = []

for i in 0...2 {
  let input_line = readLine()!
  let split: [String] = input_line.componentsSeparatedByString(" ")
  for j in 0...2 {
    bingo_card.append(split[j])
  }
}

let numOfNumbers = Int(readLine()!)!

for i in 0...numOfNumbers-1 {
  numbers.append(readLine()!)
}

for i in 0...bingo_card.count-1 {
  var status = false
  for j in 0...numbers.count-1 {
    if numbers[j] == bingo_card[i] {
      status = true
    }
  }
  
  bingo_status.append(status)
}

if bingo_status[0] && bingo_status[1] && bingo_status[2] {
  print("Yes")
} else if bingo_status[3] && bingo_status[4] && bingo_status[5] {
  print("Yes")
} else if bingo_status[6] && bingo_status[7] && bingo_status[8] {
  print("Yes")
} else if bingo_status[0] && bingo_status[3] && bingo_status[6] {
  print("Yes")
} else if bingo_status[1] && bingo_status[4] && bingo_status[7] {
  print("Yes")
} else if bingo_status[2] && bingo_status[5] && bingo_status[8] {
  print("Yes")
} else if bingo_status[0] && bingo_status[4] && bingo_status[8] {
  print("Yes")
} else if bingo_status[2] && bingo_status[4] && bingo_status[6] {
  print("Yes")
} else {
  print("No")
}