program main
  implicit none
  integer :: n, i, j, k, a(3, 3), b(10)
  logical :: chosen(3, 3), bingo
  do i = 1, 3
    read (*, *) a(:, i)
  end do
  read (*, *) n
  do k = 1, n
    read (*, *) b(k)
  end do

  chosen(:, :) = .false.
  do k = 1, n
    do i = 1, 3
      do j = 1, 3
        if (a(j, i) == b(k)) chosen(j, i) = .true.
      end do
    end do
  end do

  bingo = .false.
  do i = 1, 3
    bingo = bingo .or. (chosen(1, i) .and. chosen(2, i) .and. chosen(3, i))
    bingo = bingo .or. (chosen(i, 1) .and. chosen(i, 2) .and. chosen(i, 3))
  end do
  bingo = bingo .or. (chosen(1, 1) .and. chosen(2, 2) .and. chosen(3, 3))
  bingo = bingo .or. (chosen(3, 1) .and. chosen(2, 2) .and. chosen(1, 3))
  if (bingo) then
    write (*, "(a)") "Yes"
  else
    write (*, "(a)") "No"
  end if
end program main
