map_dict = dict()
for i in range(3):
    a1, a2, a3 = input().split()
    map_dict[a1] = 1 + i * 3
    map_dict[a2] = 2 + i * 3
    map_dict[a3] = 3 + i * 3

win_pattern = [
    (1, 2, 3),
    (4, 5, 6),
    (7, 8, 9),
    (1, 4, 7),
    (2, 5, 8),
    (3, 6, 9),
    (1, 5, 9),
    (3, 5, 7),
]
n = int(input())
scored = []
for i in range(n):
    b = input()
    try:
        scored.append(map_dict[b])
    except:
        pass
scored = set(scored)

flag = False
for pattern in win_pattern:
    if set(pattern).issubset(scored):
        print('Yes')
        flag = True
        break
if not flag:
    print('No')
