#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<int>> a(3, vector<int>(3, 0));
  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 b;
    cin >> b;
    for (int j = 0; j < (3); j++)
      for (int k = 0; k < (3); k++)
        if (a[j][k] == b) a[j][k] = 0;
  }
  bool ans = false;
  for (int i = 0; i < (3); i++) {
    if (a[i][0] == 0 && a[i][1] == 0 && a[i][2] == 0) ans = true;
    if (a[0][i] == 0 && a[1][i] == 0 && a[2][i] == 0) ans = true;
  }
  if (a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0) ans = true;
  if (a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0) ans = true;
  if (ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
