program main

  implicit none
  integer :: a(3,3), n
  integer, allocatable :: b(:) 

  integer :: i,j,k
  integer :: aa(3,3) = 0
  
  read(*,*) a(1,:)
  read(*,*) a(2,:)
  read(*,*) a(3,:)
  read(*,*) n
  allocate( b(n) )
  do i = 1, n
    read(*,*) b(i)
  end do

  do k = 1, 10
    do i = 1, 3
      do j = 1, 3
        if( a(i,j) == b(k) ) aa(i,j) = 1
      end do
    end do
  end do
  
  k = 0
  if( sum( aa(1,:) ) == 3 ) k = k + 1
  if( sum( aa(2,:) ) == 3 ) k = k + 1
  if( sum( aa(3,:) ) == 3 ) k = k + 1
  if( sum( aa(:,1) ) == 3 ) k = k + 1
  if( sum( aa(:,2) ) == 3 ) k = k + 1
  if( sum( aa(:,3) ) == 3 ) k = k + 1
  if( ( aa(1,1) + aa(2,2) + aa(3,3) ) == 3 ) k = k + 1
  if( ( aa(1,3) + aa(2,2) + aa(3,1) ) == 3 ) k = k + 1
  
  if ( k > 0 ) then
    print*, "Yes"
  else
    print*, "No"
  end if
  
 
end program main
