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