#include <bits/stdc++.h>
using namespace std;
int main() {
  long long arr[5][5], n, a;
  map<long long, long long> mp;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> arr[i][j];
    }
  }
  cin >> n;
  while (n--) {
    cin >> a;
    mp[a] = 5;
  }
  long long cnt = 0, arr1[10], arr2[10];
  for (int i = 0; i < 10; i++) arr1[i] = 0, arr2[i] = 0;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if (i == j) {
        if (mp[arr[i][j]] != 0) cnt++;
      }
      if (mp[arr[i][j]] != 0) {
        arr1[i]++;
        arr2[j]++;
      }
    }
  }
  if (cnt == 3)
    cout << "Yes" << endl;
  else {
    long long pk = 0;
    for (int i = 0; i < 3; i++) {
      if (arr1[i] == 3 || arr2[i] == 3) {
        cout << "Yes" << endl;
        pk = 10;
        break;
      }
    }
    if (pk == 0) cout << "No" << endl;
  }
}
