program main
 implicit none
 integer A(3,3)
 integer :: get(3,3)=0
 integer N
 integer,allocatable :: b(:)
 integer i
 integer ii,jj
 integer :: bingo=0

 read *,A(1,1),A(1,2),A(1,3)
 read *,A(2,1),A(2,2),A(2,3)
 read *,A(3,1),A(3,2),A(3,3)
 read *,N
 allocate(b(N))
 do i=1,N
  read *,b(i)
 end do

 do i=1,N
  do ii=1,3
   do jj=1,3
    if ( A(ii,jj) == b(i) ) get(ii,jj)=1
   end do
  end do
 end do

 do i=1,3
  if ( get(i,1)==1 .and. get(i,2)==1 .and. get(i,3)==1 ) bingo=1
 end do
 do i=1,3
  if ( get(1,i)==1 .and. get(2,i)==1 .and. get(3,i)==1 ) bingo=1
 end do
  if ( get(1,1)==1 .and. get(2,2)==1 .and. get(3,3)==1 ) bingo=1
  if ( get(3,1)==1 .and. get(2,2)==1 .and. get(3,1)==1 ) bingo=1

 if ( bingo == 1 ) then
  print '(A)', 'Yes'
 else
  print '(A)', 'No'
 end if

 endprogram main
