   program abc157b
      implicit none
      integer,dimension(3,3)::A
      integer,allocatable,dimension(:)::B
      integer::N,i,j,k,judge1,judge2,judge3,judge4

      do i=1,3
         read *,A(i,1:3)
      end do
      read *,N
      allocate(B(N))
      do i=1,N
         read *,B(i)
      end do

      do i=1,N
         do j=1,3
            do k=1,3
               if (B(i)==A(j,k)) A(j,k)=0
            end do
         end do
      end do

      do i=1,3
         judge1=3
         do j=1,3
            if (A(i,j)==0) judge1=judge1-1
         end do
         if (judge1==0) then
            print *,'Yes'
            go to 10
         end if
      end do

      do i=1,3
         judge2=3
         do j=1,3
            if (A(j,i)==0) judge2=judge2-1
         end do
         if (judge2==0) then
            print *,'Yes'
            go to 10
         end if
      end do

      judge3=3
      do i=1,3
         if (A(i,i)==0) judge3=judge3-1
         if (judge3==0) then
            print *,'Yes'
            go to 10
         end if
      end do

      judge4=3
      do i=1,3
         if (A(i,3-i+1)==0) judge4=judge4-1
         if (judge4==0) then
            print *,'Yes'
            go to 10
         end if
      end do

      if (judge1/=0.and.judge2/=0.and.judge3/=0.and.judge4/=0) &
         print *,'No'
10    continue
      stop

   end program abc157b