#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[10];
  long long n;
  long long b[20];
  long long ans[10];
  for (int i = 0; i < 9; i++) {
    cin >> a[i];
    ans[i] = 1000;
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    for (int j = 0; j < 9; j++) {
      if (a[j] == b[i]) {
        ans[j] = 0;
        break;
      }
    }
  }
  if (ans[0] + ans[1] + ans[2] == 0) {
    cout << "Yes";
  } else if (ans[3] + ans[4] + ans[5] == 0) {
    cout << "Yes";
  } else if (ans[6] + ans[7] + ans[8] == 0) {
    cout << "Yes";
  } else if (ans[0] + ans[3] + ans[6] == 0) {
    cout << "Yes";
  } else if (ans[1] + ans[4] + ans[7] == 0) {
    cout << "Yes";
  } else if (ans[2] + ans[5] + ans[8] == 0) {
    cout << "Yes";
  } else if (ans[0] + ans[4] + ans[8] == 0) {
    cout << "Yes";
  } else if (ans[2] + ans[4] + ans[6] == 0) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}
