module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.stdio;
import std.string;
import std.traits;

struct Input
{
	int[][] a;
    int n;
    int[] b;
}

void parseInput(T)(out Input input, T file)
{
	with (file) with (input)
	{
        foreach (i; 0..3)
            a ~= readln().strip().split().map!(to!int).array();
		n = readln().strip().to!int;
        foreach (i; 0..n)
            b ~= readln().strip().to!int;
	}
}

auto main2(Input* input)
{
	with (input)
	{
        foreach (bb; b)
            foreach (aa; a)
                foreach (ref aaa; aa)
                    if (aaa == bb)
                        aaa = 0;
        for (int i = 0; i < 3; i++)
        {
            if (a[i].all!((e)=>e==0))
                return "Yes";
        }
        for (int i = 0; i < 3; i++)
        {
            if (a.map!((e)=>e[i]).all!((e)=>e==0))
                return "Yes";
        }

        if (a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0)
            return "Yes";

        if (a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0)
            return "Yes";

        return "No";
	}
}

alias retType = ReturnType!main2;
static if (!is(retType == void))
{
	unittest { writeln("begin unittest"); }
	auto _placeholder_ = ReturnType!main2.init;

	unittest // example1
	{
		string example =
`84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30`;
		if (example.empty) return;
		Input input = void;
		parseExample(input, example);
		auto result = main2(&input);
		printResult(result);
		assert(result == "Yes");
	}

	unittest // example2
	{
		string example =
`41 7 46
26 89 2
78 92 8
5
6
45
16
57
17`;
		if (example.empty) return;
		Input input = void;
		parseExample(input, example);
		auto result = main2(&input);
		printResult(result);
		assert(result == "No");
	}

	unittest // example3
	{
		string example =
`60 88 34
92 41 43
65 73 48
10
60
43
88
11
48
73
65
41
92
34`;
		if (example.empty) return;
		Input input = void;
		parseExample(input, example);
		auto result = main2(&input);
		printResult(result);
		assert(result == "Yes");
	}

	unittest { writeln("end unittest"); }

	void parseExample(out Input input, string example)
	{
		struct Adapter
		{
			string[] _lines;
			this(string input) { _lines = input.splitLines(); }
			string readln() { auto line = _lines[0]; _lines = _lines[1..$]; return line; }
		}
		parseInput(input, Adapter(example));
	}
}

void printResult(T)(T result)
{
	static if (isFloatingPoint!T) writefln("%f", result);
	else writeln(result);
}

void main()
{
	Input input = void;
	parseInput(input, stdin);
	alias retType = ReturnType!main2;
	static if (is(retType == void))
		main2(&input);
	else
	{
		auto result = main2(&input);
		printResult(result);
	}
}
