program test
implicit none
integer::N
integer::A(3,3)
integer,allocatable::B(:)
integer::i,ans
ans=0
!fortranは縦が速い
do i=1,3
	read*,A(:,i)
end do
!ビンゴの読み込み
read*,N
allocate(B(N))
do i=1,N
	read*,B(i)
end do
!ビンゴヒットしたところを0
do i=1,N
	where(A==b(i))
    	A=0
    end where
end do
!ビンゴチェック
do i=1,3
if(A(i,1)==0 .and. A(i,2)==0 .and. A(i,3)==0)then
	ans = 1
end if
end do

do i=1,3
if(A(1,i)==0 .and. A(2,i)==0 .and. A(3,i)==0)then
	ans = 1
end if
end do

if(A(1,1)==0 .and. A(2,2)==0 .and. A(3,3)==0)then
	ans=1
end if

if(A(1,3)==0 .and. A(2,2)==0 .and. A(3,1)==0)then
	ans=1
end if

if(ans==1)then 
	print*,'Yes'
else
	print*,'No'
end if
end program test