#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vpi = vector<pi>;
using ld = long double;
const int maxn = 2e5 + 55, mod = 1e9 + 7, i2 = (mod + 1) / 2;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int a[3][3];
set<int> x;
bool check(int a) { return x.count(a); }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 0; i < 9; i++) cin >> a[i / 3][i % 3];
  int n;
  cin >> n;
  for (int t; n--;) cin >> t, x.insert(t);
  for (int i = 0; i < n; i++) {
    if (check(a[i][0]) && check(a[i][1]) && check(a[i][2]))
      return cout << "Yes", 0;
    if (check(a[0][i]) && check(a[1][i]) && check(a[2][i]))
      return cout << "Yes", 0;
  }
  if (check(a[0][0]) && check(a[1][1]) && check(a[2][2]))
    return cout << "Yes", 0;
  cout << "No";
}
