#include <bits/stdc++.h>
using namespace std;
int main() {
  int bingo[3][3];
  bool appear[3][3];
  for (int i = 0; i < (3); ++i) {
    for (int j = 0; j < (3); ++j) {
      cin >> bingo[i][j];
    }
  }
  int n;
  string ans = "No";
  cin >> n;
  int b[10];
  for (int i = 0; i < (n); ++i) {
    cin >> b[i];
  }
  for (int j = 0; j < (n); ++j) {
    for (int k = 0; k < (n); ++k) {
      for (int l = 0; l < (n); ++l) {
        appear[j][k] = false;
        if (b[l] == bingo[j][k]) {
          appear[j][k] = true;
        }
      }
    }
  }
  for (int i = 0; i < (3); ++i) {
    if (appear[i][0] == appear[i][1] == appear[i][2]) {
      ans = "Yes";
      cout << ans << endl;
      return 0;
    }
  }
  for (int j = 0; j < (3); ++j) {
    if (appear[0][j] == appear[1][j] == appear[2][j]) {
      ans = "Yes";
      cout << ans << endl;
      return 0;
    }
  }
  if (appear[0][0] == appear[1][1] == appear[2][2]) {
    ans = "Yes";
    cout << ans << endl;
    return 0;
  }
  if (appear[2][0] == appear[1][1] == appear[0][2]) {
    ans = "Yes";
    cout << ans << endl;
    return 0;
  }
  cout << ans << endl;
}
