def resolve():
    a = list(map(int, input().split()))
    a.extend(list(map(int, input().split())))
    a.extend(list(map(int, input().split())))
    n = int(input())
    for i in range(n):
        b = int(input())
        for j in range(len(a)):
            if a[j] == b:
                a[j] = -1
    x1 = a[0:3].count(-1)
    x2 = a[3:6].count(-1)
    x3 = a[6:9].count(-1)
    y1 = a[0:7:3].count(-1)
    y2 = a[1:8:3].count(-1)
    y3 = a[2:9:3].count(-1)
    nn = a[0:9:4].count(-1)

    if x1 == 3 or x2 == 3 or x3 == 3 or y1 == 3 or y2 == 3 or y3 == 3 or nn == 3:
        print('Yes')
    else:
        print('No')