program main 
 implicit none 
 integer,allocatable ::  b(:)
 integer :: a(3,3)
 integer :: n,i,same,j,k
  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,3
   do j=1,3
    do k=1,n
    if (a(i,j)==b(k)) then
     a(i,j)=same
    end if
    end do
   end do
  end do
  
   if (a(1,1)==same.and.a(2,2)==same.and.a(3,3)==same) then
    write (*,*) 'Yes' 
    stop
   else if (a(1,3)==same.and.a(2,2)==same.and.a(3,1)==same) then
    write (*,*) 'Yes'
    stop
   end if
   
  do i=1,3
   if (a(1,i)==same.and.a(2,i)==same.and.a(3,i)==same) then
    write (*,*) 'Yes'
    stop
   else if (a(i,1)==same.and.a(i,2)==same.and.a(i,3)==same) then
    write (*,*) 'Yes'
    stop
   end if
  end do
    write (*,*) 'No'
    stop
    
 end program main
