import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    auto A = new long[][](3);
    foreach (i; 0 .. 3)
        A[i] = aryread();
    long N = lread();
    auto B = new bool[][](3, 3);
    foreach (_; 0 .. N)
    {
        long b = lread();
        foreach (i; 0 .. 3)
            foreach (j; 0 .. 3)
                if (A[i][j] == b)
                {
                    B[i][j] = true;
                }
    }
    bool a = B[0][0] && B[0][1] && B[0][2];
    bool b = B[1][0] && B[1][1] && B[1][2];
    bool c = B[2][0] && B[2][1] && B[2][2];
    bool d = B[0][0] && B[1][0] && B[2][0];
    bool e = B[0][1] && B[1][1] && B[2][1];
    bool f = B[0][2] && B[1][2] && B[2][2];
    bool g = B[0][0] && B[1][1] && B[2][2];
    bool h = B[0][2] && B[1][1] && B[2][0];
    if (a || b || c || d || e || f || g || h)
    {
        writeln("Yes");
    }
    else
    {
        writeln("No");
    }

}
