#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int a[3][3];
  int d[3][3];
  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 < (3); ++i) {
    int b;
    cin >> b;
    for (int j = 0; j < (3); ++j)
      if (a[i][j] == b) d[i][j] = 1;
  }
  bool ans = false;
  for (int i = 0; i < (3); ++i) {
    int cnt = 0;
    for (int j = 0; j < (3); ++j) {
      cnt += d[i][j];
      if (cnt == 3) ans = true;
    }
  }
  for (int i = 0; i < (3); ++i) {
    int cnt = 0;
    for (int j = 0; j < (3); ++j) cnt += d[j][i];
    if (cnt == 3) ans = true;
  }
  {
    int cnt = 0;
    for (int j = 0; j < (3); ++j) cnt += d[j][j];
    if (cnt == 3) ans = true;
  }
  {
    int cnt = 0;
    for (int j = 0; j < (3); ++j) {
      cnt += d[j][2 - j];
      if (cnt == 3) ans = true;
    }
  }
  puts(ans ? "Yes" : "No");
  return 0;
}
