#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, count = 0;
  bool ans = 0;
  vector<vector<int>> bingo(3, vector<int>(3));
  vector<int> tama(110);
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> bingo.at(i).at(j);
    }
  }
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> tama.at(i);
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < N; k++) {
        if (bingo.at(i).at(j) == tama.at(k)) {
          count++;
        }
      }
      if (count == 2) {
        ans = 1;
        break;
      }
    }
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < N; k++) {
        if (bingo.at(j).at(i) == tama.at(k)) {
          count++;
        }
      }
      if (count == 2) {
        ans = 1;
        break;
      }
    }
  }
  for (int i = 0; i < 3; i++) {
    for (int k = 0; k < N; k++) {
      if (bingo.at(i).at(i) == tama.at(k)) {
        count++;
      }
    }
    if (count == 2) {
      ans = 1;
      break;
    }
  }
  for (int k = 0; k < 3; k++) {
    if (bingo.at(1).at(3) == tama.at(k) && bingo.at(2).at(2) == tama.at(k) &&
        bingo.at(3).at(1) == tama.at(k)) {
      ans = 1;
    }
  }
  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  if (ans) {
    return 1;
  } else {
    return 0;
  }
}
