#include <bits/stdc++.h>
using namespace std;
using LL = long long;
mt19937 dlsrand(random_device{}());
mt19937 mrand(std::chrono::system_clock::now().time_since_epoch().count());
int rnd(int x) { return mrand() % x; }
LL bin(LL x, LL n, LL MOD) {
  LL ret = MOD != 1;
  for (x %= MOD; n; n >>= 1, x = x * x % MOD)
    if (n & 1) ret = ret * x % MOD;
  return ret;
}
inline LL get_inv(LL x, LL p) { return bin(x, p - 2, p); }
const double PI = acos(-1.0);
constexpr int maxn = 1e6 + 10;
constexpr int INF = 0x3f3f3f3f;
constexpr long long linf = 0x3f3f3f3f3f3f3f3f;
constexpr int mod = 1e9 + 7;
int a[10][10], x, n;
bool vis[10][10];
int main() {
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) {
      cin >> a[i][j];
    }
  }
  cin >> n;
  while (n--) {
    cin >> x;
    for (int i = 1; i <= 3; i++) {
      for (int j = 1; j <= 3; j++) {
        if (x == a[i][j]) vis[i][j] = true;
      }
    }
  }
  int fl = 0;
  for (int i = 1; i <= 3; i++) {
    if (vis[i][1] && vis[i][2] == 1 && vis[i][1] == 1) {
    }
    fl = 1;
  }
  for (int j = 1; j <= 3; j++) {
    if (vis[1][j] && vis[3][j] && vis[2][j]) {
      fl = 1;
    }
  }
  if (vis[1][1] == vis[2][2] && vis[1][1] == vis[3][3] && vis[1][1]) fl = 1;
  for (int i = 1; i <= 3; i++) {
    int tmp = 1;
    if (!vis[i][4 - i]) tmp = 0;
    if (tmp) fl = tmp;
  }
  puts(fl ? "Yes" : "No");
}
