program ABC157B
    implicit none
    integer(8)::A(3,3),C(3,3),N,i,j,k,b,flg=0
    read*,A,N
    C=0
    do k=1,N
        read*,b
        do i=1,3
            do j=1,3
                if(A(j,i)==b)C(j,i)=1
            end do
        end do
    end do

    do i=1,3
        if(sum(C(i,:))==3.or.sum(C(:,i))==3)flg=1
    end do
    if(C(1,1)+C(2,2)+C(3,3)==3.or.C(1,3)+C(2,2)+C(3,1)==3)flg=1
    if(flg==1)print'(A)',"Yes"
    if(flg==0)print'(A)',"No"
end program ABC157B