CARD_SIZE = 3


def solve(card, called_numbers):
    import numpy as np

    checked_card = np.vectorize(lambda n: n in called_numbers)(card)

    for l in checked_card:
        if all(l):
            return True

    for l in zip(*checked_card):
        if all(l):
            return True

    if all([checked_card[n][n] for n in range(CARD_SIZE)]):
        return True
    if all([checked_card[n][CARD_SIZE - n - 1] for n in range(CARD_SIZE)]):
        return True

    return False


def resolve():
    logger.info("start solving")
    card = [[int(row) for row in input().split()] for _ in range(CARD_SIZE)]
    logger.debug("card: {}".format(card))

    N = int(input())
    logger.debug("N: {}".format(N))
    called_numbers = {int(input()) for n in range(N)}
    logger.debug("called_numbers: {}".format(called_numbers))

    ret = solve(card, called_numbers)

    print("Yes" if ret else "No")


if __name__ == '__main__':
    resolve()