#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = std::vector<int>;
using vll = std::vector<long long>;
using vull = std::vector<unsigned long long>;
void setIO(std::ifstream &readFile, std::ofstream &writeFile,
           const std::string &name = "", bool stdIO = false) {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
  if (!name.empty() && !stdIO) {
    readFile.open(name + ".in");
    if (readFile.fail()) return;
    writeFile.open(name + ".out");
    std::cin.rdbuf(readFile.rdbuf());
    std::cout.rdbuf(writeFile.rdbuf());
  }
}
class Timer {
  std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;

 public:
  Timer() : m_beg(std::chrono::high_resolution_clock::now()) {}
  void reset() { m_beg = std::chrono::high_resolution_clock::now(); }
  [[nodiscard]] long double elapsed() const {
    return std::chrono::duration_cast<
               std::chrono::duration<long double, std::ratio<1>>>(
               std::chrono::high_resolution_clock::now() - m_beg)
        .count();
  }
};
using dt = int;
constexpr dt MAXN = 1e5 + 1;
constexpr dt MOD = 1e9 + 7;
constexpr long double EPS = 1e-9;
int main(int argc, char *argv[]) {
  static std::ifstream readFile;
  static std::ofstream writeFile;
  setIO(readFile, writeFile);
  vector<vector<int>> grid(3, vector<int>(3));
  for (auto &row : grid)
    for (auto &node : row) cin >> node;
  int n;
  cin >> n;
  while (n--) {
    int b;
    cin >> b;
    for (auto &row : grid)
      for (auto &node : row)
        if (node == b) node = 0;
  }
  bool works = false;
  for (int i = 0; i < n; ++i) {
    works |= (!grid[0][i] && !grid[1][i] && !grid[2][i]);
    works |= (!grid[i][0] && !grid[i][1] && !grid[2][1]);
  }
  works |= (!grid[1][1] &&
            (!grid[0][0] && !grid[2][2] || !grid[0][2] && !grid[2][0]));
  cout << (works ? "Yes" : "No") << '\n';
}
