// Slower C++ solution:
#define _USE_MATH_DEFINES



#include <iostream>

#include <math.h> 

#include <vector>

#include <algorithm>

#include <iomanip>      // std::setprecision

#include <map>

#include <unordered_map>

#include <string>

#include <set>

#include <unordered_set>

#include <sstream>



using namespace std;



int main()

{

	int N;

	std::set<int> nums;

	vector<vector<int>> card(3,std::vector<int>(3,0));

	for (int i = 0; i < 3; ++i)

	{

		for (int j = 0; j < 3; ++j)

		{

			int input;

			std::cin >> input;

			card[i][j] = input;

		}

	}



	std::cin >> N;

	for (int k = 0; k < N; ++k)

	{

		int num;

		std::cin >> num;

		nums.insert(num);

	}

	//check rows

	for (int i = 0; i < 3; ++i)

	{

		int counter = 0;

		for (int j = 0; j < 3; ++j)

		{

			if (nums.find(card[i][j]) != nums.end())

			{

				counter++;

			}

			else

			{

				break;

			}

		}

		if (counter == 3)

		{

			std::cout << "Yes\n";

			return 0;

		}

	}

	//check columns

	for (int i = 0; i < 3; ++i)

	{

		int counter = 0;

		for (int j = 0; j < 3; ++j)

		{

			if (nums.find(card[j][i]) != nums.end())

			{

				counter++;

			}

			else

			{

				break;

			}

		}

		if (counter == 3)

		{

			std::cout << "Yes\n";

			return 0;

		}

	}



		int counter = 0;

		for (int j = 0; j < 3; ++j)

		{

			if (nums.find(card[j][j]) != nums.end())

			{

				counter++;

			}

			else

			{

				break;

			}

		}

		if (counter == 3)

		{

			std::cout << "Yes\n";

			return 0;

		}

		counter = 0;

		for (int j = 0; j < 3; ++j)

		{

			if (nums.find(card[j][2-j]) != nums.end())

			{

				counter++;

			}

			else

			{

				break;

			}

		}

		if (counter == 3)

		{

			std::cout << "Yes\n";

			return 0;

		}

	std::cout << "No\n";



}


// Faster C++ solution for the same problem (measured speedup: 5.305129728175045x):
#include <stdio.h>



int main() {

    int bingos[3][3] = {0};

    bool bingos_mark[3][3] = {false};

    int ninp;

    for (int i = 0; i < 3; i++) {

        for (int j = 0; j < 3; j++) {

            scanf("%d", &bingos[i][j]);

        }

    }

    scanf("%d", &ninp);

    for (int i = 0; i < ninp; i++) {

        int te;

        scanf("%d", &te);

        for (int i = 0; i < 3; i++) {

            for (int j = 0; j < 3; j++) {

                if (te == bingos[i][j]) {

                    bingos_mark[i][j] = true;

                }

            }

        }

    }



    if (bingos_mark[0][0] && bingos_mark[1][1] && bingos_mark[2][2]) {

        printf("Yes");

    } else if (bingos_mark[0][2] && bingos_mark[1][1] && bingos_mark[2][0]) {

        printf("Yes");

    } else if (bingos_mark[0][0] && bingos_mark[0][1] && bingos_mark[0][2]) {

        printf("Yes");

    } else if (bingos_mark[1][0] && bingos_mark[1][1] && bingos_mark[1][2]) {

        printf("Yes");

    } else if (bingos_mark[2][0] && bingos_mark[2][1] && bingos_mark[2][2]) {

        printf("Yes");

    } else if (bingos_mark[0][0] && bingos_mark[1][0] && bingos_mark[2][0]) {

        printf("Yes");

    } else if (bingos_mark[0][1] && bingos_mark[1][1] && bingos_mark[2][1]) {

        printf("Yes");

    } else if (bingos_mark[0][2] && bingos_mark[1][2] && bingos_mark[2][2]) {

        printf("Yes");

    } else {

        printf("No");

    }

}