#include <bits/stdc++.h>
const long long int mod = 1e9 + 7;
const long long int INF = 10000000000000;
using namespace std;
set<long long int> s;
bool p(long long int x) {
  if (s.find(x) != s.end())
    return true;
  else
    return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  long long int ar[3][3];
  for (long long int i = 0; i < 3; ++i) {
    for (long long int j = 0; j < 3; ++j) cin >> ar[i][j];
  }
  long long int n = 0;
  cin >> n;
  for (long long int i = 0; i < n; ++i) {
    long long int x = 0;
    cin >> x;
    s.insert(x);
  }
  bool f = false;
  for (long long int i = 0; i < 3; ++i) {
    if (p(ar[i][0]) and p(ar[i][1]) and p(ar[i][2])) f = true;
  }
  for (long long int i = 0; i < 3; ++i) {
    if (p(ar[0][i]) and p(ar[1][i]) and p(ar[2][i])) f = true;
  }
  if (p(ar[0][0]) and p(ar[1][1]) and p(ar[2][2])) f = true;
  if (p(ar[2][0]) and p(ar[1][1]) and p(ar[0][2])) f = true;
  if (f)
    cout << "Yes";
  else
    cout << "No";
}
