program abc
	implicit none
	integer :: i,j,n,m,y
	integer :: aij(3,3)=0,xij(3,3)=0
	integer :: bn(10)=0
    
	do i = 1, 3
		read(*,*) (aij(i,j),j=1,3)
	enddo 
	read(*,*) n
	do m = 1, n
		read(*,*) bn(m)
		do i = 1, 3
		do j = 1, 3
			if(bn(m) == aij(i,j)) then
				xij(i,j) = 1
			endif
		enddo
		enddo
	enddo

	y = 0

	if(xij(1,1) + xij(1,2) + xij(1,3) == 3) y = 1
	if(xij(2,1) + xij(2,2) + xij(2,3) == 3) y = 1
	if(xij(3,1) + xij(3,2) + xij(3,3) == 3) y = 1 

	if(xij(1,1) + xij(2,1) + xij(3,1) == 3) y = 1
	if(xij(1,2) + xij(2,2) + xij(3,2) == 3) y = 1
	if(xij(1,3) + xij(2,3) + xij(3,3) == 3) y = 1

	if(xij(1,1) + xij(2,2) + xij(3,3) == 3) y = 1
	if(xij(3,1) + xij(2,2) + xij(1,3) == 3) y = 1

	if(y == 1) then
    		write(*,*) 'Yes'
	else
    		write(*,*) 'No'
	endif

end program abc