program main
    implicit none
    integer n
    integer, dimension(3,3) :: a, d
    integer, dimension(8) :: sum
    integer, allocatable, dimension(:) :: b
    integer i,j,k,flag
    read(*,*) a(1,1), a(1,2), a(1,3)
    read(*,*) a(2,1), a(2,2), a(2,3)
    read(*,*) a(3,1), a(3,2), a(3,3)
    read(*,*) n
    allocate(b(n))
    do i = 1,n
        read(*,*) b(i)
    end do
    d = 1
    do i = 1,n
        do j = 1,3
            do k = 1,3
                if(a(j,k) == b(i)) then 
                    d(j,k) = 0
                end if
            end do
        end do
    end do
    
    sum(1) = d(1,1)+d(1,2)+d(1,3)
    sum(2) = d(2,1)+d(2,2)+d(2,3)
    sum(3) = d(3,1)+d(3,2)+d(3,3)
    sum(4) = d(1,1)+d(2,1)+d(3,1)
    sum(5) = d(1,2)+d(2,2)+d(3,2)
    sum(6) = d(1,3)+d(2,3)+d(3,3)
    sum(7) = d(1,1)+d(2,2)+d(3,3)
    sum(8) = d(1,3)+d(2,2)+d(3,1)
    flag = 0
    
    do i = 1,8
        if(sum(i) == 0) then
            write(*,*) "Yes"
            flag = 1
        end if
    end do
    if(flag == 0) write(*,*) "No"
end program