program kadai
integer  ::  N,i
integer  ::  a(3,3)
integer,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 (a(j,k)==b(i)) then
                a(j,k)=1000
            end if
        end do
    end do
    do k=1,3
        if (a(k,1)==1000 .and. a(k,2)==1000 .and. a(k,3)==1000) then
            write(*,*) "Yes"
            stop
        end if
        if (a(1,k)==1000 .and. a(2,k)==1000 .and. a(3,k)==1000) then
            write(*,*) "Yes"
            stop
        end if
    end do
    if (a(1,1)==1000 .and. a(2,2)==1000 .and. a(3,3)==1000) then
        write(*,*) "Yes"
        stop
    end if
    if (a(3,1)==1000 .and. a(2,2)==1000 .and. a(1,3)==1000) then
        write(*,*) "Yes"
        stop
    end if
end do

write(*,*) "No"

stop



end program kadai
