#include <bits/stdc++.h>
using namespace std;
map<int, pair<int, int> > m;
int a, b, n;
bool vis[5][5];
int main() {
  for (int i = 1; i <= 3; ++i) {
    for (int j = 1; j <= 3; ++j) {
      scanf("%d", &a);
      m[a] = make_pair(i, j);
    }
  }
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &b);
    if (m.find(b) != m.end()) {
      vis[m[b].first][m[b].second] = true;
    }
  }
  for (int i = 1; i <= 3; ++i) {
    if (vis[i][1] && vis[i][2] && vis[i][3]) {
      printf("Yes\n");
      return 0;
    }
  }
  for (int i = 1; i <= 3; ++i) {
    if (vis[1][i] && vis[2][i] && vis[3][i]) {
      printf("Yes\n");
      return 0;
    }
  }
  if (vis[1][1] && vis[2][2] && vis[3][3]) {
    printf("Yes\n");
    return 0;
  }
  if (vis[1][3] && vis[2][2] && vis[3][1]) {
    printf("Yes\n");
    return 0;
  }
  printf("No\n");
  return 0;
}
