#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n, i, j, k;
  int a[3][3];
  bool ha[3][3];
  for (i = 0; i < 3; ++i) {
    for (j = 0; j < 3; ++j) {
      cin >> a[i][j];
      ha[i][j] = false;
    }
  }
  cin >> n;
  if (n <= 2) {
    cout << "No" << endl;
    return 0;
  }
  vector<int> b(n);
  for (i = 0; i < n; ++i) {
    cin >> b[i];
  }
  for (i = 0; i < n; ++i) {
    for (j = 0; j < 3; ++j) {
      for (k = 0; k < 3; ++k) {
        if (a[j][k] == b[i]) {
          ha[j][k] = true;
        }
      }
    }
  }
  bool ans = false;
  for (i = 0; i < 3; ++i) {
    if (ha[0][i] == false) {
      i = 3;
      ans = false;
    } else {
      ans = true;
    }
  }
  for (i = 0; i < 3; ++i) {
    if (ha[1][i] == false) {
      i = 3;
      ans = false;
    } else {
      ans = true;
    }
  }
  for (i = 0; i < 3; ++i) {
    if (ha[2][i] == false) {
      i = 3;
      ans = false;
    } else {
      ans = true;
    }
  }
  for (i = 0; i < 3; ++i) {
    if (ha[i][0] == false) {
      i = 3;
      ans = false;
    } else {
      ans = true;
    }
  }
  for (i = 0; i < 3; ++i) {
    if (ha[i][1] == false) {
      i = 3;
      ans = false;
    } else {
      ans = true;
    }
  }
  for (i = 0; i < 3; ++i) {
    if (ha[i][2] == false) {
      i = 3;
      ans = false;
    } else {
      ans = true;
    }
  }
  if (ha[0][0] == true && ha[1][1] == true && ha[2][2] == true) {
    ans = true;
  }
  if (ha[0][2] == true && ha[1][1] == true && ha[2][0] == true) {
    ans = true;
  }
  if (ans == true) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
