#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;

int main(){
  vector<int> a(9);
  vector<int> b(9);
  rep(i,9) cin >> a[i];
  int n;
  cin >> n;
  rep(i,n){
    int tmp;
    cin >> tmp;
    rep(j,9){
      if (a[j]==tmp) b[j]=1;
    }
  }
  int ans = 0;
  rep(i,3){
    if (b[0+i]+b[3+i]+b[6+i]==3) ans = 1;
    if (b[i*3+0]+b[i*3+1]+b[i*3+2] == 3) ans = 1;
  }
  if (b[0]+b[4]+b[8]==3) ans = 1;
  if (b[2]+b[4]+b[6]==3) ans = 1;
  
  if (ans==0) cout << "No";
  else cout << "Yes";
}
