#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << "(" << p.first << " " << p.second << ")";
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  //os << v[0]; for (ll i = 1; i < (ll)v.size(); i++){ os << " " << v[i]; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::map< T, S > m)
{
  ll i = 0; for (auto p : m){ os << " [" << i << "]" << p.first << "->" << p.second; i++;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

// GCD, LCM
ll gcd(ll a, ll b) {
  while (b != 0) { a %= b; std::swap(a, b); }
  return a;
}
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

int main()
{
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  bool judge = false;

  ll H = 3;
  ll W = 3;
  std::map<ll, std::pair<ll, ll> >mp;
  std::vector< std::vector<ll> > grid(H, std::vector<ll>(W, 0LL));
  for (ll y = 0; y < H; y++) {
    for (ll x = 0; x < W; x++) {
      std::cin >> grid[y][x];
      mp[grid[y][x]] = std::pair<ll, ll>(y, x);
    }
  }

  ll N;
  std::cin >> N;
  for (ll i = 0; i < N; i++) {
    ll num;
    std::cin >> num;
    if (mp.count(num) != 0) {
      grid[mp[num].first][mp[num].second] = -1;
    }
    //print(mp[num].first, mp[num].second, grid[mp[num].first][mp[num].second]);
  }

  // 横
  for (ll y = 0; y < H; y++) {
    bool is_ok = true;
    for (ll x = 0; x < W; x++) {
      if (grid[y][x] != -1) is_ok = false;
    }
    if (is_ok) judge = true;
  }

  // 縦
  for (ll x = 0; x < W; x++) {
    bool is_ok = true;
    for (ll y = 0; y < H; y++) {
      if (grid[y][x] != -1) is_ok = false;
    }
    if (is_ok) judge = true;
  }

  // 斜め1
  bool is_ok;

  is_ok = true;
  for (ll a = 0; a < W; a++) {
    if (grid[a][a] != -1) is_ok = false;
  }
  if (is_ok) judge = true;

  // 斜め2
  is_ok = true;
  for (ll a = 0; a < W; a++) {
    if (grid[a][W-a-1] != -1) is_ok = false;
  }
  if (is_ok) judge = true;

  if (judge) print("Yes");
  else print("No");

  return 0;
}


Measured memory_bytes: 256