program ABC157_B
  integer::A(9),C(3,3)
  integer,dimension(:),allocatable::B
  read(5,*)A
  read(5,*)N
  allocate(B(N))
  read(5,*)B
  do I=1,N
     do J=1,9
        if(A(J)==B(I)) then
           A(J)=0
           exit
        end if
     end do
  end do
  C=reshape(A,(/3,3/))
  K=0
  if(C(1,1)+C(2,2)+C(3,3)==0 .or. C(3,1)+C(2,2)+C(3,1)==0) K=1
  do I=1,3
     if(sum(C(I,:))==0 .or. sum(C(:,I))==0) then
        K=1
        exit
     end if
  end do
  if(K==1) then
     write(6,*)'Yes'
  else
     write(6,*)'No'
  end if
end program ABC157_B