program main
  implicit none
  integer :: i, j, k, n, a(1:3,1:3)
  integer, allocatable :: b(:)
  logical :: judge = .false.
  do i = 1, 3
    read *, a(i, :)
  end do
  read *, n
  allocate (b(n))
  do i = 1, n
    read *, b(i)
  end do

  do i = 1, n
    do j = 1, 3
      do k = 1, 3
        if (a(j, k) == b(i)) then
          a(j, k) = 0
        end if
      end do
    end do
  end do
  do j = 1, 3
    if (a(j, 1) + a(j, 2) + a(j, 3) == 0) then
      judge = .true. 
    else if (a(1, j) + a(2, j) + a(3, j) == 0) then
      judge = .true.
    end if
    if (judge) exit
  end do
  if (.not. judge) then
    if (a(1,1) + a(2,2)+ a(3,3) == 0) then
      judge = .true.
    else if (a(1,3) + a(2,2) + a(3,1) == 0) then
      judge = .true.
    end if
  end if

  if (judge) then
    print '(a)', "Yes"
  else
    print '(a)', "No"
  end if

end program