#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 n, a[4][4], b[4][4], x;
int main() {
  for (LL i = (1), _i = (4); i < _i; ++i)
    for (LL j = (1), _j = (4); j < _j; ++j) cin >> a[i][j];
  cin >> n;
  for (LL i = (0), _i = (n); i < _i; ++i) {
    cin >> x;
    for (LL i = (1), _i = (4); i < _i; ++i)
      for (LL j = (1), _j = (4); j < _j; ++j) {
        if (x == a[i][j]) {
          b[i][j] = 1;
          break;
        }
      }
  }
  int fl = 0;
  if ((b[1][1] && b[2][2] && b[3][3]) || (b[1][3] && b[2][2] && b[3][1]))
    fl = 1;
  for (LL i = (1), _i = (4); i < _i; ++i) {
    if (b[i][1] && b[i][2] && b[i][3]) fl = 1;
  }
  for (LL i = (1), _i = (4); i < _i; ++i) {
    if (b[1][i] && b[2][i] && b[3][i]) fl = 1;
  }
  puts(fl ? "Yes" : "No");
}
