import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto a = new int[][](3, 3);
  foreach (i; 0..3) {
    a[i] = readln.chomp.split.to!(int[]);
  }
  auto n = readln.chomp.to!int;
  foreach (_; 0..n) {
    auto b = readln.chomp.to!int;
    foreach (i; 0..3) {
      foreach (j; 0..3) {
        if (a[i][j] == b) {
          a[i][j] = -1;
        }
      }
    }
  }
  
  auto f = false;

  foreach (i; 0..3) {
    int sum1, sum2, sum3, sum4;
    foreach (j; 0..3) {
      sum1 += a[i][j];
      sum2 += a[j][i];
      sum3 += a[j][j];
      sum4 += a[j][2-j];
    }
    if (sum1 == -3 || sum2 == -3 || sum3 == -3 || sum4 == -3) {
      f = true;
    }
  }
  if (f) {
    writeln("Yes");
  } else {
    writeln("No");
  }
}
