output_description: If we will have a bingo, print `Yes`; otherwise, print `No`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      A_{1, 1} A_{1, 2} A_{1, 3}
      A_{2, 1} A_{2, 2} A_{2, 3}
      A_{3, 1} A_{3, 2} A_{3, 3}
      N
      b_1
      \vdots
      b_N
attempt: class Cell:
      def __init__(self, x, y, num):
          self.x = x
          self.y = y
          self.num = num
          self.opened = False
  
      def open(self) -> None:
          self.opened = True
  
      def punch(self, called_number: int) -> None:
          if called_number == self.num:
              self.open()
  
  
  class Line:
      """タテ・ヨコ・ナナメいずれかのライン"""
  
      def __init__(self, values):
          self.values = values
  
      def __post_init__(self):
          # 気分で書いたけど、今回はなくても良いと思う
          if len(self.values) != 3:
              raise ValueError("今回は3つ以外ありえないよ〜")
  
      def is_bingo(self) -> bool:
          return all([c.opened for c in self.values])
  
  
  class Cells:
      """Boardって概念もあると思うけど、単純にCellのコレクションでいく"""
  
      def __init__(self, values):
          self.values = values
  
      def punch(self, called_numbers) -> None:
          for called_number in called_numbers:
              for cell in self.values:
                  cell.punch(called_number)
  
      def has_one_more_bingo(self) -> bool:
          # タテ
          tate1 = Line([c for c in self.values if c.y == 1])
          tate2 = Line([c for c in self.values if c.y == 2])
          tate3 = Line([c for c in self.values if c.y == 3])
  
          # ヨコ
          yoko1 = Line([c for c in self.values if c.x == 1])
          yoko2 = Line([c for c in self.values if c.x == 2])
          yoko3 = Line([c for c in self.values if c.x == 3])
  
          # ナナメ
          # 左上から右下に向かってのナナメ(＼)
          diag1 = Line([c for c in self.values if c.x == c.y])
  
          # 右上から左下に向かってのナナメ(／)
          diag2 = Line(
              [
                  c
                  for c in self.values
                  if (
                      ((c.x, c.y) == (1, 3))
                      or ((c.x, c.y) == (2, 2))
                      or ((c.x, c.y) == (3, 1))
                  )
              ]
          )
  
          return any(
              [
                  tate1.is_bingo(),
                  tate2.is_bingo(),
                  tate3.is_bingo(),
                  yoko1.is_bingo(),
                  yoko2.is_bingo(),
                  yoko3.is_bingo(),
                  diag1.is_bingo(),
                  diag2.is_bingo(),
              ]
          )
  
      @classmethod
      def create(cls, A):
          cells = []
  
          for row, line in enumerate(A, start=1):
              for col, num in enumerate(line, start=1):
                  cell = Cell(x=row, y=col, num=num)
                  cells.append(cell)
  
          return Cells(cells)
  
  
  def actual(n, A, B):
      cells = Cells.create(A)
  
      cells.punch(B)
  
      if cells.has_one_more_bingo():
          return "Yes"
  
      return "No"
  
  
  line1 = list(map(int, input().split()))
  line2 = list(map(int, input().split()))
  line3 = list(map(int, input().split()))
  
  A = [line1, line2, line3]
  
  n = int(input())
  B = []
  
  for _ in range(n):
      b = int(input())
      B.append(b)
  
  
  print(actual(n, A, B))
  
problem_description: Statement
  
  We have a bingo card with a 3\times3 grid. The square at the i-th row from the
  top and the j-th column from the left contains the number A_{i, j}.
  
  The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet
  contains some of those numbers, we will mark them on our sheet.
  
  Determine whether we will have a bingo when the N numbers are chosen, that is,
  the sheet will contain three marked numbers in a row, column, or diagonal.
samples: [{"input": "84 97 66\n    79 89 11\n    61 59 7\n    7\n    89\n    7\n    87\n    79\n    24\n    84\n    30", "output": "Yes\n    \n\nWe will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal\nfrom the top-left to the bottom-right.\n\n* * *"}, {"input": "41 7 46\n    26 89 2\n    78 92 8\n    5\n    6\n    45\n    16\n    57\n    17", "output": "No\n    \n\nWe will mark nothing.\n\n* * *"}, {"input": "60 88 34\n    92 41 43\n    65 73 48\n    10\n    60\n    43\n    88\n    11\n    48\n    73\n    65\n    41\n    92\n    34", "output": "Yes\n    \n\nWe will mark all the squares."}]