program main
      implicit none
      integer(4) :: n, i, j, k
      integer(4) :: a(3,3)
      integer(4), allocatable :: b(:)

      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
        do j = 1, 3
          do k = 1, 3
            if ( b(i) == a(j,k) ) a(j,k) = 0
          end do
        end do
      end do

      if (( a(1,1) == a(1,2) ) .and. ( a(1,2) == a(1,3) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(2,1) == a(2,2) ) .and. ( a(2,2) == a(2,3) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(3,1) == a(3,2) ) .and. ( a(3,2) == a(3,3) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(1,1) == a(2,1) ) .and. ( a(2,1) == a(3,1) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(1,2) == a(2,2) ) .and. ( a(2,2) == a(3,2) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(1,3) == a(2,3) ) .and. ( a(2,3) == a(3,3) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(1,1) == a(2,2) ) .and. ( a(2,2) == a(3,3) ) ) then
        print *, 'Yes'
        stop
      end if
      if (( a(1,3) == a(2,2) ) .and. ( a(2,2) == a(3,1) ) ) then
        print *, 'Yes'
        stop
      end if

      print *, 'No'

end program main
