program main
  integer :: N
  integer :: A(3,3)
  integer,allocatable :: b(:)
  integer :: i,j 
  read(*,*) A(1,:)
  read(*,*) A(2,:)
  read(*,*) A(3,:)
  read(*,*) N
  allocate(b(N))
  do i = 1,N
     read(*,*) b(i)
  end do

  do i =1,N
     where(A==b(i)) A = 0
  end do

  do i = 1,3
     if ( all(A(i,:) == 0 )) then
        write(*,'(a)') 'Yes'
        stop
     end if
  end do

  do i = 1,3
     if ( all(A(:,i) == 0 )) then
        write(*,'(a)') 'Yes'
        stop
     end if
  end do

  if ( (A(1,1) == 0 .and. A(2,2) == 0 .and. A(3,3) == 0) ) then
     write(*,'(a)') 'Yes'
     stop
  end if
  
  if ( (A(1,3) == 0 .and. A(2,2) == 0 .and. A(3,1) == 0) ) then
     write(*,'(a)') 'Yes'
     stop
  end if
  write(*,'(a)') 'No'
end program main
