table_1 = input().split()

table_2 = input().split()

table_3 = input().split()

bingo_card = table_1 + table_2 + table_3



N = int(eval(input()))



for _ in range(N):

    b = str(int(eval(input())))

    if b in bingo_card:

        bingo_card[bingo_card.index(b)] = True

        

if bingo_card[0] == bingo_card[1] == bingo_card[2]:

    print('Yes')

elif bingo_card[3] == bingo_card[4] == bingo_card[5]:

    print('Yes')

elif bingo_card[6] == bingo_card[7] == bingo_card[8]:

    print('Yes')

elif bingo_card[0] == bingo_card[3] == bingo_card[6]:

    print('Yes')

elif bingo_card[1] == bingo_card[4] == bingo_card[7]:

    print('Yes')

elif bingo_card[2] == bingo_card[5] == bingo_card[8]:

    print('Yes')

elif bingo_card[0] == bingo_card[4] == bingo_card[8]:

    print('Yes')

elif bingo_card[2] == bingo_card[4] == bingo_card[6]:

    print('Yes')

else:

    print('No')
import numpy as np





def main():

    bingo_card = np.array([list(map(int, input().split())) for _ in range(3)])

    counter = int(eval(input()))



    for _ in range(counter):

        bingo_card = np.where(bingo_card == int(eval(input())), 0, bingo_card)



    vertical_bingo = min(np.sum(bingo_card, axis=0)) == 0

    horizontal_bingo = min(np.sum(bingo_card, axis=1)) == 0



    diag_normal_bingo = bingo_card[0][0] == 0 and bingo_card[1][1] == 0 and bingo_card[2][2] == 0

    diag_reverse_bingo = bingo_card[0][2] == 0 and bingo_card[1][1] == 0 and bingo_card[2][0] == 0



    if vertical_bingo or horizontal_bingo or diag_normal_bingo or diag_reverse_bingo:

        print('Yes')

        exit()

    else:

        print('No')





if __name__ == '__main__':

    main()
table_1 = input().split()
table_2 = input().split()
table_3 = input().split()
bingo_card = table_1 + table_2 + table_3
N = int(eval(input()))
for _ in range(N):
    b = str(int(eval(input())))
    if b in bingo_card:
        bingo_card[bingo_card.index(b)] = True
if bingo_card[0] == bingo_card[1] == bingo_card[2]:
    print("Yes")
elif bingo_card[3] == bingo_card[4] == bingo_card[5]:
    print("Yes")
elif bingo_card[6] == bingo_card[7] == bingo_card[8]:
    print("Yes")
elif bingo_card[0] == bingo_card[3] == bingo_card[6]:
    print("Yes")
elif bingo_card[1] == bingo_card[4] == bingo_card[7]:
    print("Yes")
elif bingo_card[2] == bingo_card[5] == bingo_card[8]:
    print("Yes")
elif bingo_card[0] == bingo_card[4] == bingo_card[8]:
    print("Yes")
elif bingo_card[2] == bingo_card[4] == bingo_card[6]:
    print("Yes")
else:
    print("No")

import numpy as np


def main():
    bingo_card = np.array([list(map(int, input().split())) for _ in range(3)])
    counter = int(eval(input()))
    for _ in range(counter):
        bingo_card = np.where(bingo_card == int(eval(input())), 0, bingo_card)
    vertical_bingo = min(np.sum(bingo_card, axis=0)) == 0
    horizontal_bingo = min(np.sum(bingo_card, axis=1)) == 0
    diag_normal_bingo = (
        bingo_card[0][0] == 0 and bingo_card[1][1] == 0 and bingo_card[2][2] == 0
    )
    diag_reverse_bingo = (
        bingo_card[0][2] == 0 and bingo_card[1][1] == 0 and bingo_card[2][0] == 0
    )
    if vertical_bingo or horizontal_bingo or diag_normal_bingo or diag_reverse_bingo:
        print("Yes")
        exit()
    else:
        print("No")


if __name__ == "__main__":
    main()

-table_1 = input().split() -table_2 = input().split() -table_3 = input().split() -bingo_card = table_1 + table_2 + table_3 -N = int(eval(input())) -for _ in range(N): -    b = str(int(eval(input()))) -    if b in bingo_card: -        bingo_card[bingo_card.index(b)] = True -if bingo_card[0] == bingo_card[1] == bingo_card[2]: -    print("Yes") -elif bingo_card[3] == bingo_card[4] == bingo_card[5]: -    print("Yes") -elif bingo_card[6] == bingo_card[7] == bingo_card[8]: -    print("Yes") -elif bingo_card[0] == bingo_card[3] == bingo_card[6]: -    print("Yes") -elif bingo_card[1] == bingo_card[4] == bingo_card[7]: -    print("Yes") -elif bingo_card[2] == bingo_card[5] == bingo_card[8]: -    print("Yes") -elif bingo_card[0] == bingo_card[4] == bingo_card[8]: -    print("Yes") -elif bingo_card[2] == bingo_card[4] == bingo_card[6]: -    print("Yes") -else: -    print("No") +import numpy as np + + +def main(): +    bingo_card = np.array([list(map(int, input().split())) for _ in range(3)]) +    counter = int(eval(input())) +    for _ in range(counter): +        bingo_card = np.where(bingo_card == int(eval(input())), 0, bingo_card) +    vertical_bingo = min(np.sum(bingo_card, axis=0)) == 0 +    horizontal_bingo = min(np.sum(bingo_card, axis=1)) == 0 +    diag_normal_bingo = ( +        bingo_card[0][0] == 0 and bingo_card[1][1] == 0 and bingo_card[2][2] == 0 +    ) +    diag_reverse_bingo = ( +        bingo_card[0][2] == 0 and bingo_card[1][1] == 0 and bingo_card[2][0] == 0 +    ) +    if vertical_bingo or horizontal_bingo or diag_normal_bingo or diag_reverse_bingo: +        print("Yes") +        exit() +    else: +        print("No") + + +if __name__ == "__main__": +    main()