#!/usr/bin/perl
use strict;

my @r0 = split (/ /, <>);
my @r1 = split (/ /, <>);
my @r2 = split (/ /, <>);
my $num = <>;

my @matrix = (
  [@r0],
  [@r1],
  [@r2] 
);

my @bingo;
for (my $i = 0; $i < $num; $i++) {
  $bingo[$i] = <>;
}
chomp(@bingo);

#row check
my $row_match = 0;
for (my $k = 0;$k <= 2; $k++) {
  for (my $i = 0; $i <= $#bingo; $i++) {
    for (my $j = 0; $j <= 2; $j++) {
        if ($matrix[$k][$j] == $bingo[$i]) {
           $row_match++;
        }
    }
    if ($row_match == 3) {
      print "Yes";
      exit;
    } 
  }
  $row_match = 0;
}

#column check
my $col_match = 0;

for (my $j = 0; $j <= 2; $j++) {
  for (my $k = 0; $k <= 2; $k++) {
    for (my $i =0;$i <= $#bingo; $i++) {
      if ($matrix[$k][$j] == $bingo[$i]) {
        $col_match++;
      }
    }
    if ($col_match == 3) {
     print "Yes";
     exit;
    }
  }
  $col_match = 0;
}

my $daig_match = 0;
for (my $i =0;$i <= $#bingo; $i++) {
  if ($matrix[0][0] == $bingo[$i]) {
    $daig_match++;
  } if ($matrix[1][1] == $bingo[$i]) {
    $daig_match++;
  } if ($matrix[2][2] == $bingo[$i]) {
    $daig_match++;
  } 
  if ($daig_match == 3) {
    print "Yes";
    exit;
  }
}
$daig_match = 0;
for (my $i =0;$i <= $#bingo; $i++) {
  if ($matrix[0][2] == $bingo[$i]) {
    $daig_match++;
  } if ($matrix[1][1] == $bingo[$i]) {
    $daig_match++;
  } if ($matrix[2][0] == $bingo[$i]) {
    $daig_match++;
  } 
  if ($daig_match == 3) {
    print "Yes";
    exit;
  }
}
print "No";