      program abc158b
      implicit none
      integer :: a(3,3)
      integer :: n
      integer,allocatable :: b(:)
      integer :: i,j,k
      integer :: flag(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
      
      
      
      !check A
      do i = 1,3
        do j = 1,3
          do k = 1,n
            if( a(i,j)==b(k) ) flag(i,j) = 1
          end do
        end do
      end do
      
      
      do i = 1,3
        if( sum( flag(i,:) )==3 )then
          print*,'Yes';stop
        end if
        
        if( sum(flag(:,i) )==3 )then
          print*,'Yes';stop
        end if
      end do
      
      if( flag(1,1)+flag(2,2)+flag(3,3)==3 )then
        print*,'Yes';stop
      end if
      if( flag(3,1)+flag(2,2)+flag(1,3)==3 )then
        print*,'Yes';stop
      end if
      
      print*,'No'
      
      
      end
      