#!/usr/local/gnu/bin/bash
a=()
for i in `seq 3`
do
    read -a t
    a+=(`echo ${t[@]}`)
done
read n
for i in `seq $n`
do
    read b
    for j in `seq 0 8`
    do
        if((a[j]==b))
        then
            a[$j]=0
            break
        fi
    done
done
for i in `seq 0 2`
do
    if((a[3*i]+a[3*i+1]+a[3*i+2]==0||a[i]+a[i+3]+a[i+6]==0))
    then
        echo Yes
        exit
    fi
done
if((a[0]+a[4]+a[8]==0||a[2]+a[4]+a[6]==0))
then
    echo Yes
    exit
fi
echo No