package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`

	60 88 34
	92 41 43
	65 73 48
	10
	60
	43
	88
	11
	48
	73
	65
	41
	92
	34

	`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	a := [][]int{
		{nextInt(), nextInt(), nextInt()},
		{nextInt(), nextInt(), nextInt()},
		{nextInt(), nextInt(), nextInt()},
	}
	n := nextInt()
	for j := 0; j < n; j++ {
		b := nextInt()
		for x := 0; x < 3; x++ {
			for y := 0; y < 3; y++ {
				if a[y][x] == b {
					a[y][x] = 0
				}
			}
		}
	}

	ans := "No"
	for i := 0; i < 3; i++ {
		if (a[i][0] == 0 && a[i][1] == 0 && a[i][2] == 0) || (a[0][i] == 0 && a[1][i] == 0 && a[2][i] == 0) {
			ans = "Yes"
			break
		}
	}
	if (a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0) || (a[2][0] == 0 && a[1][1] == 0 && a[0][2] == 0) {
		ans = "Yes"
	}

	fmt.Fprintln(out, ans)
}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	resolve(parseProblem(os.Stdin))
}

func parseProblem(r io.Reader) ([][]int, intSet) {
	const (
		initialBufSize = 100000
		maxBufSize     = 1000000
	)
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	a := nextMatrix(3, 3, sc)
	n := nextInt(sc)
	s := newIntSet()
	for i := 0; i < n; i++ {
		s.add(nextInt(sc))
	}
	return a, s
}

type intSet map[int]none

func newIntSet() intSet {
	return map[int]none{}
}

func (s intSet) add(i int) (added bool) {
	_, ok := s[i]
	added = !ok
	s[i] = mark
	return
}

func (s intSet) remove(i int) (removed bool) {
	_, removed = s[i]
	delete(s, i)
	return
}

func (s intSet) doesContain(i int) bool {
	_, ok := s[i]
	return ok
}

func (s intSet) size() int {
	return len(s)
}

func (s intSet) members() chan int {
	ch := make(chan int)
	go func() {
		defer close(ch)
		for k := range s {
			ch <- k
		}
	}()
	return ch
}

type none struct{}

var mark none

func nextMatrix(n, m int, sc *bufio.Scanner) (matrix [][]int) {
	matrix = make([][]int, n)
	for i := 0; i < n; i++ {
		matrix[i] = make([]int, m)
		for j := 0; j < m; j++ {
			matrix[i][j] = nextInt(sc)
		}
	}
	return
}
func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())
	return int(a)
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func resolve(mx [][]int, b intSet) {
	for i := 0; i < 3; i++ {
		okL, okC := true, true
		for j := 0; j < 3; j++ {
			okL = okL && b.doesContain(mx[i][j])
			okC = okC && b.doesContain(mx[j][i])
		}
		if okL || okC {
			fmt.Println("Yes")
			return
		}
		// diagonal-l
		// diagonal-r
	}
	okL, okR := true, true
	for i := 0; i < 3; i++ {
		okL = okL && b.doesContain(mx[i][i])
		okR = okR && b.doesContain(mx[i][2-i])
	}
	if okL || okR {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
	return
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func contains(target string, list []string) bool {
	for _, r := range list {
		if target == r {
			return true
		}
	}
	return false
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()

	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextF64() float64 {
	sc.Scan()

	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func isInteger(x float64) bool {
	return math.Floor(x) == x
}

func Ave(s []int) int {
	val := 0
	for _, i := range s {
		val += i
	}
	return int(val / len(s))
}
func cal(i int) (sum int) {
	for i != 0 {
		sum += i % 10
		i /= 10
	}
	return
}
func max(a []int) (idx int, val int) {
	max := a[0]
	idx = 0
	for j, i := range a {
		if max < i {
			max = i
			idx = j
		}
	}
	return idx, max
}

func draw(i int, a []int) (l []int) {
	// p = a[i]
	for j := i; j < len(a); j++ {
		if j != len(a)-1 {
			a[j] = a[j+1]
		} else if j == len(a)-1 {
			a = a[:len(a)-1]
		}
	}
	return a
}

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Buffer([]byte{}, math.MaxInt64)
	a := make([][]int, 3)
	for i := 0; i < 3; i++ {
		a[i] = make([]int, 3)
	}
	for i := 0; i < 3; i++ {
		for j := 0; j < 3; j++ {
			a[i][j] = nextInt()
		}
	}

	n := nextInt()
	var b []int

	for i := 0; i < n; i++ {
		b = append(b, nextInt())
	}

	for _, v := range b {
		for i := 0; i < 3; i++ {
			for j := 0; j < 3; j++ {
				if v == a[i][j] {
					a[i][j] = -1
				}
			}
		}
	}

	for i := 0; i < 3; i++ {
		if (a[i][0] == -1 && a[i][1] == -1 && a[i][2] == -1) ||
			(a[0][i] == -1 && a[1][i] == -1 && a[2][i] == -1) ||
			(a[i][i] == -1 && a[i][i] == -1 && a[i][i] == -1) ||
			(a[2][0] == -1 && a[1][1] == -1 && a[0][2] == -1) {
			fmt.Println("Yes")
			return
		}
	}

	fmt.Println("No")

}


package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)

func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	a := make([][]int, 3)
	for i := range a {
		r.Scan(true)
		a[i] = r.nextStringArray().toInts()
	}

	r.Scan(true)
	n := r.nextInt()

	for i := 0; i < n; i++ {
		r.Scan(true)
		b := r.nextInt()

		for j := range a {
			for k, v := range a[j] {
				if b == v {
					a[j][k] = -1
				}
			}
		}
	}

	ans := false
	nanameL := true
	nanameR := true
	for i := range a {
		yoko := true
		tate := true
		for j := range a[i] {
			if a[i][j] != -1 {
				yoko = false
			}
			if a[j][i] != -1 {
				tate = false
			}
		}

		if ans := (yoko || tate); ans {
			break
		}
		if a[i][i] != -1 {
			nanameL = false
		}
		if a[i][2-i] != -1 {
			nanameR = false
		}

	}
	if !ans {
		ans = (nanameL || nanameR)
	}
	fmt.Fprintln(stdout, []string{"No", "Yes"}[b2i(ans)])
}


package main

import "fmt"

var bin [9]bool

func main() {
	var bingo [9]int
	var n int
	b := make(map[int]bool)
	fmt.Scanf("%d %d %d\n %d %d %d\n %d %d %d \n%d", &bingo[0], &bingo[1], &bingo[2], &bingo[3], &bingo[4], &bingo[5], &bingo[6], &bingo[7], &bingo[8], &n)
	//fmt.Println(bingo)
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scanf("%d", &tmp)
		b[tmp] = true
	}
	for i, j := range bingo {
		if b[j] {
			bin[i] = true
		}
	}
	//fmt.Println(b)
	if h(1, 2, 3) || h(4, 5, 6) || h(7, 8, 9) || h(1, 4, 7) || h(2, 5, 8) || h(3, 6, 9) || h(1, 5, 9) || h(3, 5, 7) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}
func h(a, b, c int) bool {
	if bin[a-1] || bin[b-1] || bin[c-1] {
		return true
	}
	return false
}


a = gets.split(" ").map(&:to_i)
b = gets.split(" ").map(&:to_i)
c = gets.split(" ").map(&:to_i)
bingos = []
n = gets.to_i

while bingo = gets do
    bingo = bingo.to_i
    bingos.push(bingo)
end

ary = [a,b,c]
result = []
ary.each do |line|
    line.each do |i|
        if bingos.include?(i)
            result.push(1)
        else
            result.push(0)
        end
    end
end

flag = "No"

if result[0]==1 and result[1]==1 and result[2]==1
    flag = "Yes"
elsif result[3]==1 and result[4]==1 and result[5]==1
    flag = "Yes"
elsif result[6]==1 and result[7]==1 and result[8]==1
    flag = "Yes"
elsif result[0]==1 and result[3]==1 and result[6]==1
    flag = "Yes"
elsif result[1]==1 and result[4]==1 and result[7]==1
    flag = "Yes"
elsif result[2]==1 and result[5]==1 and result[8]==1
    flag = "Yes"
elsif result[0]==1 and result[4]==1 and result[8]==1
    flag = "Yes"
elsif result[2]==1 and result[4]==1 and result[6]==1
    flag = "Yes"
end

puts flag


### SNIPPET
  # n = gets.split.map(&:to_i)
  # array = n.times.map { gets.split.map(&:to_i) }
  # [].all?(&:even?)
  # a = [*1..m].repeated_combination(n).to_a
  # [1,2,3,4,5].select { |num| num.even? }  # => [2, 4]
  # ["a","a","b"].group_by(&:itself).map{|k,v| [k, v.count]}.to_h #=> {"a"=>2, "b"=>1}
  # 切り捨て: .floor(2).to_f ,切り上げ： .ceil(2).to_f,四捨五入: round(2)
  # 3.upto(6) do |i|, 6.downto(3) do |i|
  # 公約数125.gcd(100)、公倍数125.lcm(100)
  # PI = Math::PI
  # 高さ = a * Math.sin(w / 180.0 * Math::PI), 底辺 = a * Math.cos(w / 180.0 * Math::PI)
  # def chmax(a, b) a > b ? a : b end
  # INF = Float::INFINITY
  # def chmin(a, b) a < b ? a : b end

card = []
3.times {card << gets.split.map(&:to_i)}

n = gets.to_i
hits = []
n.times {hits << gets.to_i}

hits.each do |h|
  3.times do |i|
    3.times do |j|
      if h == card[i][j]
        card[i][j] = 0
      end
    end
  end
end

flag = false
tcard = card.transpose
3.times do |k|
  if card[k].inject(:+) == 0 || tcard[k].inject(:+) == 0
    flag = true
  end
end

if card[0][0] == 0 && card[1][1] == 0 && card[2][2] == 0
  flag = true
end

if card[0][2] == 0 && card[1][1] == 0 && card[2][0] == 0
  flag = true
end

# puts flag ? "Yes" : "No"
if flag
  puts "Yes"
else
  puts "No"
end


a = 3.times.map{gets.chomp.split.map(&:to_i)}

n = gets.chomp.to_i

# 横

ans = 'No'
n.times do
  b = gets.to_i
  3.times do |i|
    3.times do |j|
      a[i][j] = '○' if a[i][j] == b
      if a[i].count('○') > 2
        ans = 'Yes'
      end
    end
  end
end

# 縦3つ
3.times do |i|
  if a[0][i] == '○' && a[1][i] == '○' && a[2][i] == '○'
    ans = 'Yes'
  end
end

# 斜め(左上から右下)
if a[0][0] == '○' && a[1][1] == '○' && a[2][2] == '○'
  ans = 'Yes'
end

# 斜め版(右上から左下)
if a[0][2] == '○' && a[1][1] == '○' && a[2][0] == '○'
  ans = 'Yes'
end

puts ans


require 'set'
CARD = 3.times.map{gets.split.map(&:to_i)}.flatten
N = gets.to_i
DECRALE = N.times.map { gets.to_i }

DECRALE.each do |i|
    CARD.map!{|x| x==i ? 0 : x}
end

zero_index = CARD.each_with_index.map { |x,i| x==0 ? i : nil }.compact.to_set
BINGO = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,6,8],[0,4,8],[2,4,6]]
ans = "No"
BINGO.each.with_index do |x,i|
    if x.to_set.subset?(zero_index) then
        ans = "Yes"
        break
    end
end

puts ans


card = Array.new(3){gets.split.map(&:to_i)}
n = gets.to_i
ans = "No"
n.times do
  b = gets.to_i
  3.times do |i|
    3.times do |j|
      if card[i][j] == b
        card[i][j] = -1
      end
    end
  end
end

#横
card.each do |row|
  ans = "Yes" if row.all?{|a| a<0}
end

#縦
card.transpose do |column|
  ans = "Yes" if column.all?{|a| a<0}
end
#斜め1
ans = "Yes" if card[0][0]<0 && card[1][1]<0 && card[2][2]<0

#斜め2
ans = "Yes" if card[0][2]<0 && card[1][1]<0 && card[2][0]<0

puts ans


a = []
3.times do
  a << gets.split.map(&:to_i).to_a
end

N = gets.to_i
ans = Array.new(3) { Array.new(3, false) }

N.times do
  b = gets.to_i
  3.times do |i|
    3.times do |j|
      if a[i][j] == b
        ans[i][j] = true
        puts "a=#{a[i][j]}, b=#{b}"
      end
    end
  end
end

3.times do |i|
  mark = 0
  3.times do |j|
    next unless ans[i][j]
    mark += 1
    if mark == 3
      puts 'Yes1'
      exit
    end
  end
end

3.times do |j|
  mark = 0
  3.times do |i|
    next if ans[i][j] != true
    mark += 1
    if mark == 3
      puts 'Yes2'
      exit
    end
  end
end

if ans[0][0] && ans[1][1] && ans[2][2]
  puts 'Yes3'
  exit
end

if ans[0][2] && ans[1][1] && ans[2][0]
  puts 'Yes4'
  exit
end

puts 'No'


// Vicfred
// https://atcoder.jp/contests/abc157/tasks/abc157_b
// simulation
use std::io;
use std::collections::HashSet;

fn main() {
    let mut A = Vec::<Vec<i64>>::new();
    for _ in 0..3 {
        let mut line = String::new();

        io::stdin()
            .read_line(&mut line)
            .unwrap();

        let words: Vec<i64> =
            line
            .split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect();

        A.push(words);
    }

    let mut N = String::new();

    io::stdin()
        .read_line(&mut N)
        .unwrap();

    let N: i64 = N.trim().parse().unwrap();

    let mut bingo = HashSet::new();

    for _ in 0..N {
        let mut b = String::new();

        io::stdin()
            .read_line(&mut b)
            .unwrap();

        let b: i64 = b.trim().parse().unwrap();
        bingo.insert(b);
    }

    let row1: HashSet<_> = [A[0][0], A[0][1], A[0][2]].iter().cloned().collect();
    let row2: HashSet<_> = [A[1][0], A[1][1], A[1][2]].iter().cloned().collect();
    let row3: HashSet<_> = [A[2][0], A[2][1], A[2][2]].iter().cloned().collect();
    let col1: HashSet<_> = [A[0][0], A[1][0], A[2][0]].iter().cloned().collect();
    let col2: HashSet<_> = [A[0][1], A[1][1], A[2][1]].iter().cloned().collect();
    let col3: HashSet<_> = [A[0][2], A[1][2], A[2][2]].iter().cloned().collect();
    let dia1: HashSet<_> = [A[0][0], A[1][1], A[2][2]].iter().cloned().collect();
    let dia2: HashSet<_> = [A[0][2], A[1][1], A[2][0]].iter().cloned().collect();

    let mut ans = false;
    if row1.is_subset(&bingo) ||
        row2.is_subset(&bingo) ||
        row3.is_subset(&bingo) ||
        col1.is_subset(&bingo) ||
        col2.is_subset(&bingo) ||
        col3.is_subset(&bingo) ||
        dia1.is_subset(&bingo) ||
        dia2.is_subset(&bingo) {
        ans = true;
    }

    if ans {
        println!("Yes");
    } else {
        println!("No");
    }
}


use std::collections::HashMap;
use std::io;

type Board = Vec<Vec<bool>>;
type Layout = HashMap<Ball, (usize, usize)>;
type Balls = Vec<Ball>;
type Ball = i32;

fn init_board() -> Board {
    vec![
        vec![false, false, false],
        vec![false, false, false],
        vec![false, false, false],
    ]
}

fn set_ball(board: &mut Board, layout: &Layout, b: Ball) {
    match layout.get(&b) {
        None => return,
        Some(&(x, y)) => board[x][y] = true,
    }
}

fn any_bingo(board: &Board) -> bool {
    for x in 0..3 {
        if board[x][0] && board[x][1] && board[x][2] {
            return true;
        }
    }
    for y in 0..3 {
        if board[0][y] && board[1][y] && board[2][y] {
            return true;
        }
    }
    if board[0][0] && board[1][1] && board[2][2] {
        return true;
    }
    if board[0][2] && board[1][1] && board[2][0] {
        return true;
    }
    return false;
}

fn solve(layout: &Layout, balls: &Balls) -> bool {
    let mut board = init_board();
    for b in balls {
        set_ball(&mut board, &layout, *b);
    }
    any_bingo(&board)
}

fn main() {
    let mut layout: Layout = HashMap::new();
    for y in 0..3 {
        let mut input = String::new();
        io::stdin().read_line(&mut input).unwrap();
        let mut iter = input.split_whitespace();
        for x in 0..3 {
            let a: i32 = iter.next().unwrap().parse().unwrap();
            layout.insert(a, (x, y));
        }
    }
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let n: usize = input.trim().parse().unwrap();
    let mut balls: Vec<i32> = Vec::with_capacity(n);
    for _ in 0..n {
        let mut input = String::new();
        io::stdin().read_line(&mut input).unwrap();
        let b: i32 = input.trim().parse().unwrap();
        balls.push(b);
    }
    if solve(&layout, &balls) {
        println!("Yes");
    } else {
        println!("No");
    }
}


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {

        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    /*     input! {
        n: usize,
        mut plan: [(i32, i32, i32); n],  // Vec<(i32, i32, i32)>
    }
 */
    input! {
        a_s: [[u16;3];3],
        n: usize,
        b: [u16;n],
    }
    let mut asss = a_s.clone();
    for i in b.iter(){
        for ass in asss.iter_mut(){
            match ass.iter().enumerate().find(|&(_,a)| a == i).map(|(k,_)|k) {
                Some(k) => ass[k] = 0,
                None => (),
            }
         }
    }
    if asss[0][0] == 0 && asss[0][1] == 0 && asss[0][2] == 0
    || asss[1][0] == 0 && asss[1][1] == 0 && asss[1][2] == 0
    || asss[2][0] == 0 && asss[2][1] == 0 && asss[2][2] == 0
    || asss[0][0] == 0 && asss[1][0] == 0 && asss[2][0] == 0
    || asss[0][1] == 0 && asss[1][1] == 0 && asss[2][1] == 0
    || asss[0][2] == 0 && asss[1][2] == 0 && asss[2][2] == 0
    || asss[0][0] == 0 && asss[1][1] == 0 && asss[2][2] == 0
    || asss[0][2] == 0 && asss[1][1] == 0 && asss[2][0] == 0{
        println!("Yes");
    }else{
        println!("No");
    }
}