#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5][5], n, i, j, k;
  string ans;
  for (i = 0; i <= 2; i++) {
    cin >> a[i][0] >> a[i][1] >> a[i][2];
  }
  cin >> n;
  int b, at[5][5] = {0};
  for (i = 0; i < n; i++) {
    cin >> b;
    for (j = 0; j < 3; j++) {
      for (k = 0; k < 3; k++) {
        if (a[j][k] == b) at[j][k] = 1;
      }
    }
  }
  ans = "No";
  for (i = 0; i <= 2; i++) {
    if (at[i][0] + at[i][1] + at[i][2] == 3) ans = "Yes";
    if (at[0][i] + at[1][i] + at[2][i] == 3) ans = "Yes";
  }
  if (at[0][0] + at[1][1] + at[2][2] == 3) ans = "Yes";
  if (at[0][2] + at[1][1] + at[2][0] == 3) ans = "Yes";
  cout << ans << endl;
  return 0;
}
