A11,A12,A13,A21,A22,A23,A31,A32,A33 = map(int,input().split(" "))
bingo = [A11,A12,A13,A21,A22,A23,A31,A32,A33]
bingo = ",".join(map(str,bingo))
N = int(input())
for i in range(N):
    b = input()
    if b in bingo:
        bingo.replace(b,True)
    else:
        pass
Bingo = bingo.split(",")
Flag = False
if Bingo[0] == Bingo[1] == Bingo[2]==True:
    Flag = True
if Bingo[3] == Bingo[4] == Bingo[6]==True:
    Flag = True
if Bingo[6] == Bingo[7] == Bingo[8]==True:
    Flag = True
if Bingo[0] == Bingo[3] == Bingo[6]==True:
    Flag = True
if Bingo[1] == Bingo[4] == Bingo[7]==True:
    Flag = True
if Bingo[2] == Bingo[5] == Bingo[8]==True:
    Flag = True
if Bingo[0] == Bingo[4] == Bingo[8]==True:
    Flag = True
if Bingo[2] == Bingo[4] == Bingo[6]==True:
    Flag = True
else:
    pass
if flag == True:
    print("Yes")
else:
    print("No")