#include <bits/stdc++.h>
#pragma GCC optimize("O999")
const int INF = 0x3f3f3f3f;
const int maxn = 50000005;
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int a[4][4], n, x;
  for (int i = 1; i <= 3; i++)
    for (int j = 1; j <= 3; j++) cin >> a[i][j];
  cin >> n;
  int b[4][4];
  for (int i = 1; i <= 3; i++)
    for (int j = 1; j <= 3; j++) b[i][j] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    for (int j = 1; j <= 3; j++)
      for (int k = 1; k <= 3; k++)
        if (a[j][k] == x) b[j][k] == 1;
  }
  int f = 1;
  for (int i = 1; i <= 3; i++) {
    f = 1;
    for (int j = 1; j <= 3; j++)
      if (b[i][j] == 0) f = 0;
    if (f == 1) {
      cout << "Yes" << endl;
      return 0;
    }
    f = 1;
    for (int j = 1; j <= 3; j++)
      if (b[j][i] == 0) f = 0;
    if (f == 1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  f = 1;
  for (int i = 1; i <= 3; i++)
    if (b[i][i] == 0) f = 0;
  if (f == 1) {
    cout << "Yes" << endl;
    return 0;
  }
  if (b[1][3] == 1 && b[2][2] == 1 && b[3][1] == 1) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}
