#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[20], b[110], c[20];
  int N;
  for (int i = 0; i < 9; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 9; i++) c[i] = a[i];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 9; j++) {
      if (b[i] == c[j]) a[j] = 0;
    }
  }
  int f = a[0] + a[1] + a[2];
  int g = a[3] + a[4] + a[5];
  int h = a[6] + a[7] + a[8];
  int j = a[0] + a[3] + a[6];
  int k = a[1] + a[4] + a[7];
  int l = a[2] + a[5] + a[8];
  int z = a[0] + a[4] + a[8];
  int t = a[2] + a[4] + a[6];
  if (f == 0 || g == 0 || h == 0 || j == 0 || k == 0 || l == 0 || z == 0 ||
      t == 0) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
  return 0;
}
