#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int a[3][3];
void bingo(int x) {
  for (int i = 0; i < (int)(3); i++) {
    for (int j = 0; j < (int)(3); j++) {
      if (a[i][j] == x) a[i][j] = 0;
    }
  }
}
bool judge() {
  int cnt = 0;
  for (int i = 0; i < (int)(3); i++) {
    cnt = 0;
    for (int j = 0; j < (int)(3); j++) {
      cnt += a[i][j];
    }
    if (cnt == 0) return true;
  }
  for (int i = 0; i < (int)(3); i++) {
    cnt = 0;
    for (int j = 0; j < (int)(3); j++) {
      cnt += a[j][i];
    }
    if (cnt == 0) return true;
  }
  cnt = 0;
  for (int i = 0; i < (int)(3); i++) {
    cnt += a[i][i];
  }
  if (cnt == 0) return true;
  cnt = 0;
  for (int i = 0; i < (int)(3); i++) {
    cnt += a[2 - i][i];
  }
  if (cnt == 0) return true;
  return false;
}
int main() {
  int n;
  for (int i = 0; i < (int)(3); i++) {
    for (int j = 0; j < (int)(3); j++) {
      cin >> a[i][j];
    }
  }
  cin >> n;
  for (int i = 0; i < (int)(n); i++) {
    int b;
    cin >> b;
    bingo(b);
  }
  if (judge()) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
