#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<long long> > bingo(3, vector<long long>(3, 0));
  vector<vector<bool> > result(3, vector<bool>(3, false));
  for (int i = (0); i < (3); ++i) {
    cin >> bingo[i][0] >> bingo[i][1] >> bingo[i][2];
  }
  int N;
  cin >> N;
  int nums[N];
  for (int i = (0); i < (N); ++i) {
    cin >> nums[i];
  }
  for (int j = 0; j < 3; ++j) {
    for (int k = 0; k < 3; ++k) {
      for (int i = (0); i < (N); ++i) {
        if (bingo[j][k] == nums[i]) {
          result[j][k] = true;
          break;
        }
      }
    }
  }
  for (int j = 0; j < 3; ++j) {
    if (result[j][0] && result[j][1] && result[j][2]) {
      cout << "Yes" << endl;
      return 0;
    }
    if (result[0][j] && result[1][j] && result[2][j]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (result[0][0] && result[1][1] && result[2][2]) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}
