Problem: We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.  The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.  Determine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.

Submission attempts (in order):
def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(map(int,input().split())) for i in range(n)]
    for bingo in b:
        for i in range(3):
            for j in range(3):
                if a[i][j] == bingo:
                    a[i][j] = 0
    for i in range(3):
        if all(a[i][j] == 0 for in range(3)):
            print("Yes")
            return
        if all(a[j][i] == 0 for in range(3)):
            print("Yes")
            return
    if (a[0][0] == a[1][1] == a[2][2] == 0) or (a[0][2] == a[1][1] == a[2][0] == 0):
        print("Yes")
        return

    print("No")
B()

def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(int(input())) for i in range(n)]
    for bingo in b:
        for i in range(3):
            for j in range(3):
                if a[i][j] == bingo:
                    a[i][j] = 0
    if (a[0][0] == a[1][1] == a[2][2] == 0) or (a[0][2] == a[1][1] == a[2][0] == 0):
        print("Yes")
        return
    for i in range(3):
        if all(a[i][j] == 0 for j in range(3)) or all(a[j][i] == 0 for j in range(3)):
            print("Yes")
            return
    print("No")


def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(map(int,input().split())) for i in range(n)]
    import itertools
    a_list = list(itertools.chain.from_iterable(a))
    for bingo in b:
        if bingo in a_list:
            a_list[a_list.index(bingo)] = 0
    if (a_list[0+0] == a_list[3*1+1] == a_list[3*2+2] == 0) or (a_list[0+2] == a_list[3+1] == a_list[3*2] == 0):
        print("Yes")
        return
    for i in range(3):
        if (a_list[i*3+0] == a_list[i*3+1] == a_list[i*3+2] == 0) or (a_list[0+i] == a_list[3*1+i] == a_list[3*2+i] == 0):
            print("Yes")
            return
    print("No")
B()

def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(map(int,input().split())) for i in range(n)]
    for bingo in b:
        for i in range(3):
            for j in range(3):
                if a[i][j] == bingo:
                    a[i][j] = 0
    if (a[0][0] == a[1][1] == a[2][2] == 0) or (a[0][2] == a[1][1] == a[2][0] == 0):
        print("Yes")
        return
    for i in range(3):
        if (a[i][0] == a[i][1] == a[i][2] == 0) or (a[0][i] == a[1][i] == a[2][i] == 0):
            print("Yes")
            return
    print("No")
B()

def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(int(input())) for i in range(n)]
    for bingo in b:
        for i in range(3):
            for j in range(3):
                if a[i][j] == bingo:
                    a[i][j] = 0
    if (a[0][0] == a[1][1] == a[2][2] == 0) or (a[0][2] == a[1][1] == a[2][0] == 0):
        print("Yes")
        return
    for i in range(3):
        if all(a[i][j] == 0 for j in range(3)) or all(a[j][i] == 0 for j in range(3)):
            print("Yes")
            return
    print("No")
B()

def B():
    mat = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(map(int,input().split())) for i in range(n)]
    for bingo in b:
        for i in range(3):
            for j in range(3):
                if mat[i][j] == bingo:
                    mat[i][j] = 0
for i in range(3):
    if all(mat[i][j] == 0 for j in range(3)):
        print('Yes')
        break
    if all(mat[j][i] == 0 for j in range(3)):
        print('Yes')
        break
else:
    if mat[0][0] == mat[1][1] == mat[2][2] == 0 or\
            mat[0][2] == mat[1][1] == mat[2][0] == 0:
        print('Yes')
    else:
        print('No')
B()

def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(map(int,input().split())) for i in range(n)]
    import itertools
    a_list = list(itertools.chain.from_iterable(a))
    if a_list[0] in b and a_list[4] in b and a_list[8] in b:
        print("Yes")
        return
    for i in range(3):
        row = True
        col = True
        dig = True
        for j in range(3):
            if row and a_list[i*3+j] not in b:
                row = False
            if col and a_list[j*3+i] not in b:
                col = False
        if row or col:
            print("Yes")
            return
    print("No")
B()

def B():
    mat = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(map(int,input().split())) for i in range(n)]
    for bingo in b:
        for i in range(3):
            for j in range(3):
                if mat[i][j] == bingo:
                    mat[i][j] = 0
    for i in range(3):
        if all(mat[i][j] == 0 for j in range(3)):
            print('Yes')
            break
        if all(mat[j][i] == 0 for j in range(3)):
            print('Yes')
            break
    else:
        if mat[0][0] == mat[1][1] == mat[2][2] == 0 or\
                mat[0][2] == mat[1][1] == mat[2][0] == 0:
            print('Yes')
        else:
            print('No')
B()

def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(map(int,input().split())) for i in range(n)]
    bingo = [0]*9
    for i in range(3):
        for j in range(3):
            if a[i][j] in b:
                bingo[i*3+j] = 1
    if (bingo[0+0] == bingo[3*1+1] == bingo[3*2+2] == 1) or (bingo[0+2] == bingo[3+1] == bingo[3*2] == 1):
        print("Yes")
        return
    for i in range(3):
        if (bingo[i*3+0] == bingo[i*3+1] == bingo[i*3+2] == 1) or (bingo[0+i] == bingo[3*1+i] == bingo[3*2+i] == 1):
            print("Yes")
            return
    print("No")
B()

def B():
    mat = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(map(int,input().split())) for i in range(n)]
    for bingo in b:
        for i in range(3):
            for j in range(3):
                if mat[i][j] == bingo:
                    mat[i][j] = 0
    for i in range(3):
        if all(mat[i][j] == 0 for j in range(3)):
            print('Yes')
            break
        if all(mat[j][i] == 0 for j in range(3)):
            print('Yes')
            break
    else:
        if mat[0][0] == mat[1][1] == mat[2][2] == 0 or\
                mat[0][2] == mat[1][1] == mat[2][0] == 0:
            print('Yes')
        else:
            print('No')
B()

def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(map(int,input().split())) for i in range(n)]
    for bingo in b:
        for i in range(3):
            for j in range(3):
                if a[i][j] == bingo:
                    a[i][j] = 0
    for i in range(3):
        if (a[i][0] == a[i][1] == a[i][2] == 0):
            print("Yes")
            return
        if (a[0][i] == a[1][i] == a[2][i] == 0):
            print("Yes")
            return
    if (a[0][0] == a[1][1] == a[2][2] == 0) or (a[0][2] == a[1][1] == a[2][0] == 0):
        print("Yes")
        return

    print("No")
B()

def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(map(int,input().split())) for i in range(n)]
    for bingo in b:
        for i in range(3):
            for j in range(3):
                if a[i][j] == bingo:
                    a[i][j] = 0
    for i in range(3):
        if all(a[i][j] == 0 for j in range(3)):
            print("Yes")
            return
        if all(a[j][i] == 0 for j in range(3)):
            print("Yes")
            return
    if (a[0][0] == a[1][1] == a[2][2] == 0) or (a[0][2] == a[1][1] == a[2][0] == 0):
        print("Yes")
        return

    print("No")
B()

def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(map(int,input().split())) for i in range(n)]
    bingo = [0]*9
    for i in range(3):
        for j in range(3):
            if a[i][j] in b:
                bingo[i*3+j] = 1
    if (bingo[0] == bingo[3+1] == bingo[3*2+2] == 1) or (bingo[2] == bingo[3+1] == bingo[3*2] == 1):
        print("Yes")
        return
    for i in range(3):
        if (bingo[i*3+0] == bingo[i*3+1] == bingo[i*3+2] == 1) or (bingo[0+i] == bingo[3*1+i] == bingo[3*2+i] == 1):
            print("Yes")
            return
    print("No")
B()

def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(map(int,input().split())) for i in range(n)]
    for bingo in b:
        for i in range(3):
            for j in range(3):
                if a[i][j] == bingo:
                    a[i][j] = 0
    if (a[0][0] == a[1][1] == a[2][2] == 0) or (a[0][2] == a[1][1] == a[2][0] == 0):
        print("Yes")
        return
    for i in range(3):
        if (a[i][0] == a[i][1] == a[i][2] == 0):
            print("Yes")
            return
        if (a[0][i] == a[1][i] == a[2][i] == 0):
            print("Yes")
            return
    print("No")
B()

def B():
    mat = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    
    for bingo in  (int(input()) for _ in range(N)):
        for i in range(3):
            for j in range(3):
                if mat[i][j] == bingo:
                    mat[i][j] = 0
    for i in range(3):
        if all(mat[i][j] == 0 for j in range(3)):
            print('Yes')
            break
        if all(mat[j][i] == 0 for j in range(3)):
            print('Yes')
            break
    else:
        if mat[0][0] == mat[1][1] == mat[2][2] == 0 or\
                mat[0][2] == mat[1][1] == mat[2][0] == 0:
            print('Yes')
        else:
            print('No')
B()

def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [int(input()) for i in range(n)]
    for bingo in b:
        for i in range(3):
            for j in range(3):
                if a[i][j] == bingo:
                    a[i][j] = 0
    if (a[0][0] == a[1][1] == a[2][2] == 0) or (a[0][2] == a[1][1] == a[2][0] == 0):
        print("Yes")
        return
    for i in range(3):
        if all(a[i][j] == 0 for j in range(3)) or all(a[j][i] == 0 for j in range(3)):
            print("Yes")
            return
    print("No")

B()

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Accepted