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