#include <bits/stdc++.h>
using namespace std;
double getTime() { return clock() / (double)CLOCKS_PER_SEC; }
void read(){};
template <typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}
void print(){};
template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}
int main() {
  int a[3][3];
  map<int, int> mp;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    mp[x] = 1;
  }
  for (int i = 0; i < 3; i++) {
    if (mp[a[i][0]] + mp[a[i][1]] + mp[a[i][2]] == 3) {
      puts("Yes");
      return 0;
    }
    if (mp[a[0][i]] + mp[a[1][i]] + mp[a[2][i]] == 3) {
      puts("Yes");
      return 0;
    }
  }
  if (mp[a[0][0]] + mp[a[1][1]] + mp[a[2][2]] == 3) {
    puts("Yes");
    return 0;
  }
  if (mp[a[0][1]] + mp[a[1][1]] + mp[a[2][0]] == 3) {
    puts("Yes");
    return 0;
  }
  puts("No");
}
