a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
a3=list(map(int,input().split()))
 
for j in range(int(input())):
    X=int(input())
    for i in range(3):
        if X in a1:
            num=a1.index(X)
            a1[num]=[0]
        
        elif X in a2:
            num=a2.index(X)
            a2[num]=[0]
            
        elif X in a3:
            num=a3.index(X)
            a3[num]=[0]
        
        
        
C=False
for i in range(3):
    if a1.count(0)==3 or a2.count(0)==3 or a3.count(0)==3 or a1[0]==a2[0]==a3[0]==[0] or a1[1]==a2[1]==a3[1]==[0] or a1[2]==a2[2]==a3[2]==[0] or a1[0]==a2[1]==a3[2]==[0] or a1[0]==a2[1]==a3[2]==[0] or a1[2]==a2[1]==a3[0]==[0]:
        C=True
 
if C==True:
    print("Yes")
else:
    print("No")