#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[9];
  cin >> a[0] >> a[1] >> a[2];
  cin >> a[3] >> a[4] >> a[5];
  cin >> a[6] >> a[7] >> a[8];
  int n = 0;
  cin >> n;
  vector<int> b;
  int tmp = 0;
  for (int i = 0; i < n; ++i) {
    cin >> tmp;
    b.push_back(tmp);
  }
  int x[9];
  for (auto& ix : x) ix = 0;
  for (auto& it : b) {
    for (int i = 0; i < 9; ++i) {
      if (a[i] == it) x[i] = 1;
    }
  }
  bool yes = false;
  if (x[0] && x[1] && x[2])
    yes = true;
  else if (x[3] && x[4] && x[5])
    yes = true;
  else if (x[6] && x[7] && x[8])
    yes = true;
  else if (x[0] && x[3] && x[6])
    yes = true;
  else if (x[1] && x[4] && x[7])
    yes = true;
  else if (x[2] && x[5] && x[8])
    yes = true;
  else if (x[0] && x[4] && x[8])
    yes = true;
  else if (x[2] && x[4] && x[6])
    yes = true;
  cout << yes ? "Yes" : "No";
}
