#include <bits/stdc++.h>
using namespace std;
int A[3][3];
bool ok[3][3];
int main() {
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      cin >> A[i][j];
    }
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int b;
    cin >> b;
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 3; ++k) {
        if (A[j][k] == b) ok[j][k] = true;
      }
    }
  }
  bool bingo = false;
  for (int i = 0; i < 3; ++i) {
    int cnt = 0;
    for (int j = 0; j < 3; ++j)
      if (ok[i][j]) cnt++;
    if (cnt == 3) bingo = true;
  }
  for (int j = 0; j < 3; ++j) {
    int cnt = 0;
    for (int i = 0; i < 3; ++i)
      if (ok[i][j]) cnt++;
    if (cnt == 3) bingo = true;
  }
  int cnt = 0;
  for (int i = 0; i < 3; ++i) {
    if (ok[i][i]) cnt++;
    if (cnt == 3) bingo = true;
  }
  if (bingo)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
