jiahuimbzuai/CoQuIR huggingface dataset:
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;
using Graph = vector<vector<int>>;

int main(){
    int A[3][3];
    bool Bingo = false;
    bool field[3][3];
    REP(i,3){
        REP(j,3) cin >> A[i][j];
    }
    int N;
    cin >> N;
    int b[N];
    REP(i,N) cin >> b[i];
    REP(i,3){
        REP(j,3){
            field[i][j] = false;
            REP(k,N){
                if(b[k] == A[i][j]) field[i][j] = true;
            }
        }
    }

    if(field[0][0]&&field[0][1]&&field[0][2]) Bingo = true;
    if(field[1][0]&&field[1][1]&&field[1][2]) Bingo = true;
    if(field[2][0]&&field[2][1]&&field[2][2]) Bingo = true;
    if(field[0][0]&&field[1][0]&&field[2][0]) Bingo = true;
    if(field[0][1]&&field[1][1]&&field[2][1]) Bingo = true;
    if(field[0][2]&&field[1][1]&&field[2][2]) Bingo = true;
    if(field[0][0]&&field[1][1]&&field[2][2]) Bingo = true;
    if(field[0][2]&&field[1][1]&&field[2][0]) Bingo = true;
    if(Bingo) cout << "Yes" << endl;
    else cout << "No" << endl;
}
//  [c]
#include <stdio.h>
int main(void){
	int i,j,N;
  	int A[3][3];
  	int c[3][3];
 	 	for(i=0;i<3;i++)
  		for(j=0;j<3;j++)
          c[i][j]=0;
  scanf("%d %d %d",&A[0][0],&A[0][1],&A[0][2]);
  scanf("%d %d %d",&A[1][0],&A[1][1],&A[1][2]);
  scanf("%d %d %d",&A[2][0],&A[2][1],&A[2][2]);
  scanf("%d",&N);
  int num[N];
  for(i=0;i<N;i++){
  	scanf("%d",&num[i]);
  }
  for(int k=0;k<N;k++){
  	for(i=0;i<3;i++){
  		for(j=0;j<3;j++){
  			if(c[i][j]==0 && A[i][j]==num[k]){
            	c[i][j]=1;
            }
  		}
  		}
    if(c[0][0]==1&&c[0][1]==1&&c[0][2]==1){
    	printf("Yes");
      return 0;
    }
        if(c[1][0]==1&&c[1][1]==1&&c[1][2]==1){
    	printf("Yes");
          return 0;
    }    if(c[2][0]==1&&c[2][1]==1&&c[2][2]==1){
    	printf("Yes");
          return 0;
    }    if(c[0][0]==1&&c[1][0]==1&&c[2][0]==1){
    	printf("Yes");
          return 0;
    }    if(c[0][1]==1&&c[1][1]==1&&c[2][1]==1){
    	printf("Yes");
          return 0;
    }    if(c[0][2]==1&&c[1][2]==1&&c[2][2]==1){
    	printf("Yes");
          return 0;
    }    if(c[0][0]==1&&c[1][1]==1&&c[2][2]==1){
    	printf("Yes");
          return 0;
    }if(c[0][2]==1&&c[1][1]==1&&c[2][0]==1){
    	printf("Yes");
          return 0;
    }
  }
  printf("No");
  return 0;
}
//  [c]
#include <stdio.h>

int main(void)
{
	int a[3][3];
	int b, n;
	int i, j, k;

	/* ビンゴカードに数字を書く */
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 3; j++)
		{
			scanf("%d", &a[i][j]);
		}
	}

	/* n個の数を選ぶ */
	scanf("%d", &n);

	for (k = 0; k < n; k++)
	{
		scanf("%d", &b);
		/* 選ばれた数に印を付ける */
		for (i = 0; i < 3; i++)
		{
			for (j = 0; j < 3; j++)
			{
				if (b == a[i][j]) {
					a[i][j] = -1;
				}
			}
		}
	}

	/* 横列のビンゴを確認する */
	for (i = 0; i < 3; i++)
	{
		if (a[i][0] == a[i][1] && a[i][1] == a[i][2])
		{
			printf("Yes\n");
			return 0;
		}
	}

	/* 縦列のビンゴを確認する */
	for (i = 0; i < 3; i++)
	{
		if (a[0][i] == a[1][i] && a[1][i] == a[2][i])
		{
			printf("Yes\n");
			return 0;
		}
	}

	/* 斜めのビンゴを2通り確認する */
	if (a[0][0] == a[1][1] && a[1][1] == a[2][2])
	{
		printf("Yes\n");
		return 0;
	}

	if (a[0][2] == a[1][1] && a[1][1] == a[2][0])
	{
		printf("Yes\n");
		return 0;
	}

	printf("No\n");

	return 0;
}
//  [c]
#include<stdio.h>
int main()
{
  int N[3][3];
  int B[3][3];
  int nb, n;
  int i, j, k;
  i = 0;
  j = 0;
  while (j < 3)
  {    
  	k = 0;
  	while (k < 3)
  	{
      B[j][k] = 0;
      k++;
     }
     j++;
  }
  while (i < 3)
  {
    scanf("%d %d %d", &N[i][0], &N[i][1], &N[i][2]);
    i++;
  }
  scanf("%d", &nb);
  i = 0;
  while (i < nb)
  {
    scanf("%d", &n);
    j = 0;
    while (j < 3)
    {
      k = 0;
      while (k < 3)
      {
        if (n == N[j][k])
        {
          B[j][k] = 1;
        }
        k++;
      }
      j++;
    }
    i++;
  }
  //行
  i = 0;
  while (i < 3)
  {
    if (B[i][0] + B[i][1] + B[i][2] == 3)
    {
      printf("Yes");
      return (0);
    }
    i++;
  }
  //列
  i = 0;
  while (i < 3)
  {
    if (B[0][i] + B[1][i] + B[2][i] == 3)
    {
      printf("Yes");
      return (0);
    }
    i++;
  }
  //斜め
  if (B[0][0] + B[1][1] + B[2][2] == 3)
    {
      printf("Yes");
      return (0);
    }
  else if (B[2][0] + B[1][1] + B[0][2] == 3)
    {
      printf("Yes");
      return (0);
    }
  printf("No");
  return (0);
}
//  [c]
#include <stdio.h>

int main(void){
  
  int a[3][3];
  int ans[3][3];
  int n;
  int b[105];
  
  for(int i=0;i<3;i++){
    scanf("%d %d %d", &a[i][0], &a[i][1], &a[i][2]);
  }
  scanf("%d", &n);
  
  for(int i=0;i<n;i++){
    scanf("%d", &b[i]);
  }
  
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      ans[i][j]=0;
      for(int k=0;k<n;k++){
        if(a[i][j]==b[k]){
          ans[i][j]=1;
        }
      }
    }
  }
  
  int hantei=0;
  
  for(int i=0;i<3;i++){
    if(ans[i][0]==1&&ans[i][1]==1&&ans[i][2]==1){
      hantei =1;
    }
    else if(ans[0][i]==1&&ans[1][i]==1&&ans[2][i]==1){
      hantei =1;
    }
  }
   if(ans[0][0]==1&&ans[1][1]==1&&ans[2][2]==1){
      hantei =1;
     //return 0;
    }
  if(hantei==1){
  printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  return 0;
}
//  [c]
#include <stdio.h>

int main(void){
  
  int a[3][3];
  int ans[3][3];
  int n;
  int b[15];
  
  for(int i=0;i<3;i++){
    scanf("%d %d %d", &a[i][0], &a[i][1], &a[i][2]);
  }
  scanf("%d", &n);
  
  for(int i=0;i<n;i++){
    scanf("%d", &b[i]);
  }
  /*
    for(int j=0;j<n;j++){
      ans[i][j]=0;
      for(int k=0;k<n;k++){
        if(a[i][j]==b[k]){
          ans[i][j]=1;
        }
      }
    }
  }
*/
  
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      ans[i][j]=0;
      for(int k=0;k<n;k++){
        if(a[i][j]==b[k]){
          ans[i][j]=1;
        }
      }
    }
  }
  
  int hantei=0;
  
  for(int i=0;i<3;i++){
    if(ans[i][0]==1&&ans[i][1]==1&&ans[i][2]==1){
      hantei =1;
    }
    else if(ans[0][i]==1&&ans[1][i]==1&&ans[2][i]==1){
      hantei =1;
    }
  }
   if(ans[0][0]==1&&ans[1][1]==1&&ans[2][2]==1){
      hantei =1;
     //return 0;
    }
  if(hantei==1){
  printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  return 0;
}
//  [c]
#include <stdio.h>

int main(void){
  
  int a[3][3];
  int ans[3][3];
  int n;
  int b[15];
  
  for(int i=0;i<3;i++){
    scanf("%d %d %d", &a[i][0], &a[i][1], &a[i][2]);
  }
  scanf("%d", &n);
  
  for(int i=0;i<n;i++){
    scanf("%d", &b[i]);
  }
  
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      ans[i][j]=0;
      for(int k=0;k<n;k++){
        if(a[i][j]==b[k]){
          ans[i][j]=1;
        }
      }
    }
  }
  
  int hantei=0;
  
  for(int i=0;i<3;i++){
    if(ans[i][0]==1&&ans[i][1]==1&&ans[i][2]==1){
      hantei =1;
    }
    else if(ans[0][i]==1&&ans[1][i]==1&&ans[2][i]==1){
      hantei =1;
    }
  }
   if(ans[0][0]==1&&ans[1][1]==1&&ans[2][2]==1){
      hantei =1;
     //return 0;
    }
  if(hantei==1){
  printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  return 0;
}
//  [javascript]
function Main(input){
	input = input.split("\n");
	var bin_arr = [];
	for(var i = 0;i<3;i++){
		var temp = input[i].split(" ");
		for(var j = 0;j<3;j++)bin_arr[i*3+j] = parseInt(temp[j],10);
	}
	var N = parseInt(input[3],10);
	var b =[];
	for(var i = 0;i<N;i++)b.push(parseInt(input[i+4],10));
	for(var i= 0;i<9;i++){
		for(var j = 0;j<N;j++){
			if(bin_arr[i] === b[j])bin_arr[i] = 0;
		}
	}
	var result = false;
	for(var i= 0; i<7;i++){
		switch(i){
			case 0:
			if(bin_arr[i] == bin_arr[i+1] && bin_arr[i] == bin_arr[i+2]){
				result = true;
			}else if(bin_arr[i] == bin_arr[i+4] && bin_arr[i] == bin_arr[i+8]){
				result = true;
			}else if(bin_arr[i] == bin_arr[i+3] && bin_arr[i] ==bin_arr[i + 6]){
				result = true;
			}
			break;
			case 1:
			if(bin_arr[i] == bin_arr[i+3] && bin_arr[i]== bin_arr[i+6])result = true;
			break;
			case 2:
			if(bin_arr[i] == bin_arr[i+2] && bin_arr[i] == bin_arr[i+4]){
				result = true;
			}else if(bin_arr[i] == bin_arr[i+3] && bin_arr[i]== bin_arr[i+6]){
				result = true;
			}
			break;
			case 3:
			if(bin_arr[i] == bin_arr[i+1] && bin_arr[i] == bin_arr[i+2])result = true;
			break;
			case 6:
			if(bin_arr[i] == bin_arr[i+1] && bin_arr[i] == bin_arr[i+2])result = true;
			break;
		}//switch
	}
	console.log(result ? "Yes":"No");
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));
//  [javascript]
(function Main(input){
	var input = input.split('\n'),
		bingo = input.slice(0,3).join(' ').split(' ');

	input.splice(0, 4);

	for(var i=input.length; i--;){
		for(var j=bingo.length; j--;){
			if(input[i] === bingo[j]){
				bingo[j] = 'bingo';
				break;
			}
		}
	}

	function check(){
		if(bingo[0] == 'bingo' && bingo[1] == 'bingo' && bingo[2] == 'bingo'){ return true; }
		if(bingo[3] == 'bingo' && bingo[4] == 'bingo' && bingo[5] == 'bingo'){ return true; }
		if(bingo[6] == 'bingo' && bingo[7] == 'bingo' && bingo[8] == 'bingo'){ return true; }
		if(bingo[0] == 'bingo' && bingo[3] == 'bingo' && bingo[6] == 'bingo'){ return true; }
		if(bingo[1] == 'bingo' && bingo[4] == 'bingo' && bingo[7] == 'bingo'){ return true; }
		if(bingo[2] == 'bingo' && bingo[5] == 'bingo' && bingo[8] == 'bingo'){ return true; }
		if(bingo[0] == 'bingo' && bingo[4] == 'bingo' && bingo[8] == 'bingo'){ return true; }
		if(bingo[2] == 'bingo' && bingo[4] == 'bingo' && bingo[6] == 'bingo'){ return true; }
		return false;
	}

	console.log(check() ? 'Yes': 'No');

})(require("fs").readFileSync("/dev/stdin","utf8"));
//  [javascript]
function Main(input) {
    var A1 = input.slice(0, 3).map(a => parseInt(a, 10));
    var A2 = input.slice(3, 6).map(a => parseInt(a, 10));
    var A3 = input.slice(6, 9).map(a => parseInt(a, 10));
    var N = parseInt(input[9], 10);
    var b = input.slice(10).map(a => parseInt(a, 10));

    for (var i = 0; i < N; i++) {
        for (var j = 0; j < 3; j++) {
            if (A1[j] === b[i]) {
                A1[j] = 0;
            }
        }
        for (var j = 0; j < 3; j++) {
            if (A2[j] === b[i]) {
                A2[j] = 0;
            }
        }
        for (var j = 0; j < 3; j++) {
            if (A3[j] === b[i]) {
                A3[j] = 0;
            }
        }
    }

    for (var i = 0; i < 3; i++) {
        if (A1[i] === 0 && A2[i] === 0 && A3[i] === 0) {
            return console.log('Yes');
        }
    }
    if (A1[0] === 0 && A1[1] === 0 && A1[2] === 0) {
        return console.log('Yes');
    }
    if (A2[0] === 0 && A2[1] === 0 && A2[2] === 0) {
        return console.log('Yes');
    }
    if (A3[0] === 0 && A3[1] === 0 && A3[2] === 0) {
        return console.log('Yes');
    }
    if (A1[0] === 0 && A2[1] === 0 && A3[2] === 0) {
        return console.log('Yes');
    }
    if (A1[2] === 0 && A2[1] === 0 && A3[0] === 0) {
        return console.log('Yes');
    }
    return console.log('No');
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));
//  [javascript]
const input = require("fs").readFileSync("/dev/stdin", "utf8")
const lines = input.split('\n')

const A = []
A.push(...lines[0].split(' ').map(Number))
A.push(...lines[1].split(' ').map(Number))
A.push(...lines[2].split(' ').map(Number))

const N = lines[3] - 0
const b = []
for (let i = 0; i < N; i++) {
  b[i] = lines[i + 4] - 0
}

for (let i = 0; i < N; i++) {
  for (let j = 0; j < A.length; j++) {
    if (A[j] === b[i]) {
      A[j] = 'b'
    }
  }
}

let ans = 'No'
if (A[0] === 'b' && A[4] === 'b' && A[8] === 'b') {
  ans = 'Yes'
} else if (A[2] === 'b' && A[4] === 'b' && A[6] === 'b') {
  ans = 'Yes'
} else if (A[0] === 'b' && A[1] === 'b' && A[2] === 'b') {
  ans = 'Yes'
} else if (A[3] === 'b' && A[4] === 'b' && A[5] === 'b') {
  ans = 'Yes'
} else if (A[6] === 'b' && A[7] === 'b' && A[8] === 'b') {
  ans = 'Yes'
} else if (A[0] === 'b' && A[3] === 'b' && A[6] === 'b') {
  ans = 'Yes'
} else if (A[1] === 'b' && A[4] === 'b' && A[7] === 'b') {
  ans = 'Yes'
} else if (A[2] === 'b' && A[6] === 'b' && A[8] === 'b') {
  ans = 'Yes'
}
console.log(ans)
//  [javascript]
"use strict";

const main = arg => {
    const input = arg.trim().split("\n");
    let card = []
    for(let i = 0; i<3; i++){
        let tmp = input[i].split(" ").map(el => parseInt(el))
        card.push(tmp)
    }
    const N = parseInt(input[3]);
    let nums = []
    for(let i = 4; i<3+1+N;i++){
        let b = parseInt(input[i])
        for(let i = 0; i<3; i++){
            for(let j=0; j<3; j++){
                if(card[i][j] == b) card[i][j] = true
            }
        }
    }
    // raw
    for(let j = 0;j<3;j++){
        let r0 = true
        let r1 = true
        let r2 = true
        r0 = r0 && (card[0][j] == true)
        r1 = r1 && (card[1][j] == true)
        r2 = r2 && (card[2][j] == true)
        if(r0||r1||r2){
            console.log('Yes')
            return
        }
    }
    // column
    for(let i = 0;i<3;i++){
        let c0 = true
        let c1 = true
        let c2 = true
        c0 = c0 && (card[i][0] == true)
        c1 = c1 && (card[i][1] == true)
        c2 = c2 && (card[i][2] == true)
        if(c0||c1||c2){
            console.log('Yes')
            return
        }
    }
    // cross
    if(card[0][0] == true && card[1][1] == true && card[2][2] == true){
        console.log("Yes")
        return
    }
    if(card[2][0] == true && card[1][1] == true && card[0][2] == true){
        console.log("Yes")
        return
    }
    console.log("No")
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
'use strict';
function main(input) {
  const arr = input.trim().split('\n');
  const head = arr[0].split(' ').map(x => Number(x));
  const body = arr[1].split(' ').map(x => Number(x));
  const foot = arr[2].split(' ').map(x => Number(x));
  const n = arr[3];
  const num = [];
  let isBingo = false;

  for (let i = 0; i < n; i ++) {
    num[i] = arr[i + 4];
    for (let j = 0; j < a.length; j ++) {
      if (head[j] === num[i]) {
        head[j] = 0;
      }
      if (body[j] === num[i]) {
        body[j] = 0;
      }
      if (foot[j] === num[i]) {
        foot[j] = 0;
      }

    }
  }

  lowBingo(head);
  lowBingo(body);
  lowBingo(foot);

  rowBingo();
  
  console.log(isBingo ? 'Yes' : 'No');
}

function lowBingo(low) { //横の検証
  if (low[0] === 0 && low[1] === 0 && low[2] === 0) {
    return isBingo = true;
  }
}

function rowBingo() {
  for (let i = 0; i < head.length; i ++) {
    if (head[i] === 0 && body[i] === 0 && foot[i] === 0) {
      return isBingo = true;
    }
  }
  if ((body[1] === 0) &&
      ((head[0] === 0 && foot[2] === 0 )||
      (head[2] === 0 && foot[0] === 0))) {
    return isBingo = true;
  }
}


main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

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

func bingo(a []int) bool {
	for i := range a {
		if a[i] != -1 {
			return false
		}
	}
	return true
}

func main() {
	a := make([]int, 9)
	for i := range a {
		a[i] = readInt()
	}

	n := readInt()
	b := make(map[int]bool)
	for i := 0; i < n; i++ {
		b[readInt()] = true
	}

	for i := range a {
		if b[a[i]] {
			a[i] = -1
		}
	}

	if bingo(a[0:3]) || bingo(a[3:6]) || bingo(a[6:9]) ||
		bingo([]int{a[0], a[3], a[6]}) || bingo([]int{a[1], a[4], a[7]}) || bingo([]int{a[2], a[5], a[8]}) ||
		bingo([]int{a[0], a[4], a[8]}) || bingo([]int{a[2], a[4], a[6]}) {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readInt() int {
	return int(readInt64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}
//  [go]
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
}
//  [go]
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()
}
//  [go]
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")

}
//  [go]
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
}
//  [ruby]
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
//  [ruby]
### 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
//  [ruby]
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
//  [ruby]
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
//  [ruby]
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
//  [ruby]
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'
//  [rust]
// 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");
    }
}
//  [rust]
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");
    }
}
//  [rust]

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");
    }
}
//  [rust]
use std::collections::HashMap;
use std::io;

fn read_line() -> String {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    input
}

fn main() {
    let mut board: HashMap<usize, (usize, usize)> = HashMap::new();
    let mut marked = vec![vec![false; 3]; 3];

    for i in 0..3 {
        let x: Vec<usize> = read_line()
            .trim()
            .split_whitespace()
            .map(|s| s.parse::<usize>().unwrap())
            .collect();

        for (j, el) in x.iter().enumerate() {
            board.insert(*el, (i, j));
        }
    }

    let ntc = read_line().trim().parse::<usize>().unwrap();
    for _ in 0..ntc {
        let x = read_line().trim().parse::<usize>().unwrap();
        if board.contains_key(&x) {
            let (i, j) = board.get(&x).unwrap();
            marked[*i][*j] = true;
        }
    }

    let any_line = marked
        .iter()
        .any(|x| (x.iter().min() == x.iter().max()) == true);

    // transpose rows into columns
    let columns: Vec<Vec<bool>> = (0..3)
        .map(|row_idx| {
            marked
                .iter()
                .flatten()
                .skip(row_idx)
                .step_by(3)
                .cloned()
                .collect()
        })
        .collect();

    let any_column = columns
        .iter()
        .any(|x| (x.iter().min() == x.iter().max()) == true);

    let first_diag: Vec<bool> = marked.iter().flatten().step_by(4).cloned().collect();
    let second_diag: Vec<bool> = marked.iter().rev().flatten().step_by(4).cloned().collect();

    let diags = vec![first_diag, second_diag];
    let any_diag = diags
        .iter()
        .any(|x| (x.iter().min() == x.iter().max()) == true);

    let verifications = vec![any_column, any_diag, any_line];
    if verifications.iter().any(|x| *x == true) == true {
        println!("Yes");
    } else {
        println!("No");
    }
}
//  [rust]
use std::collections::HashMap;
use std::io;

fn read_line() -> String {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    input
}

fn main() {
    let mut board: HashMap<usize, (usize, usize)> = HashMap::new();
    let mut marked = vec![vec![false; 3]; 3];

    for i in 0..3 {
        let x: Vec<usize> = read_line()
            .trim()
            .split_whitespace()
            .map(|s| s.parse::<usize>().unwrap())
            .collect();

        for (j, el) in x.iter().enumerate() {
            board.insert(*el, (i, j));
        }
    }

    let ntc = read_line().trim().parse::<usize>().unwrap();
    for _ in 0..ntc {
        let x = read_line().trim().parse::<usize>().unwrap();
        if board.contains_key(&x) {
            let (i, j) = board.get(&x).unwrap();
            marked[*i][*j] = true;
        }
    }

    let any_line = marked
        .iter()
        .any(|x| (x.iter().min() == x.iter().max()) == true);

    // transpose rows into columns
    let columns: Vec<Vec<bool>> = (0..3)
        .map(|row_idx| {
            marked
                .iter()
                .flatten()
                .skip(row_idx)
                .step_by(3)
                .cloned()
                .collect()
        })
        .collect();

    let any_column = columns
        .iter()
        .any(|x| (x.iter().min() == x.iter().max()) == true);

    let first_diag: Vec<bool> = marked.iter().flatten().step_by(4).cloned().collect();
    let second_diag: Vec<bool> = marked.iter().rev().flatten().step_by(4).cloned().collect();

    let diags = vec![first_diag, second_diag];
    let any_diag = diags
        .iter()
        .any(|x| (x.iter().min() == x.iter().max()) == true);

    let verifications = vec![any_column, any_diag, any_line];
    if let Some(true) = verifications.iter().any(|x| x == true) {
        println!("Yes");
    } else {
        println!("No");
    }
}
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}



func main() {
    var card = [[Int]]()
    for _ in 0..<3 {
        card.append(readInts())
    }
    let n = Int(readLine()!)!
    
    //b入力用のループ
    for _ in 1...n {
        let b = Int(readLine()!)!
        // b探索用ループ
        for i in 0..<3 {
            for j in 0..<3 {
                card[i][j] = card[i][j] == b ? 0: card[i][j]
            }
        }
    }
    for i in 0..<3 {
        // 横のビンゴ
        if card[i] == [0, 0, 0,] {
            print("Yes")
            return
        }
        var count = 0
        // 縦のビンゴ
        for j in 0..<3 {
        
            count += card[j][i] == 0 ? 1: 0
        }
        if count == 3 {
            print("Yes")
            return
        }
    }
    // 斜めのビンゴ(真ん中が空いていないとビンゴしないためチェック)
    if card[1][1] == 0 {
        if card[0][0] == 0 && card[2][2] == 0 || card[0][2] == 0 && card[2][0] == 0 {
            print("Yes")
            return
        }
    }
    print("No")
    
}

main()
//  [swift]
import Foundation

let topLine = readLine()!.components(separatedBy: " ").map{ Int($0)! }
let middleLine = readLine()!.components(separatedBy: " ").map{ Int($0)! }
let buttomLine = readLine()!.components(separatedBy: " ").map{ Int($0)! }
let N = Int(readLine()!)!
var numbers: [Int] = []
var hit: [Bool] = [false,false,false,false,false,false,false,false,false]

for i in 0...N - 1{
    numbers.append(Int(readLine()!)!)
}

for i in 0...2 {
    for j in 0...N - 1{
        if topLine[i] == numbers[j]{
            hit[i] = true
            
        } else if middleLine[i] == numbers[j] {
            hit[i + 3] = true
            
        } else if buttomLine[i] == numbers[j] {
            hit[i + 6] = true
            
        }
    }
}

if hit[0] == true && hit[1] == true && hit[2] == true  {
    print("Yes")
} else if hit[3] == true && hit[4] == true && hit[5] == true{
    print("Yes")
} else if hit[6] == true && hit[7] == true && hit[8] == true{
    print("Yes")
} else if hit[0] == true && hit[3] == true && hit[6] == true{
    print("Yes")
} else if hit[1] == true && hit[4] == true && hit[7] == true{
    print("Yes")
} else if hit[2] == true && hit[5] == true && hit[8] == true{
    print("Yes")
} else if hit[0] == true && hit[4] == true && hit[8] == true{
    print("Yes")
} else if hit[2] == true && hit[4] == true && hit[6] == true{
    print("Yes")
} else {
    print("No")
}
//  [swift]
import Foundation

var bingo_card: [String] = []
var numbers: [String] = []
var bingo_status: [Bool] = []

for i in 0...2 {
  let input_line = readLine()!
  let split: [String] = input_line.componentsSeparatedByString(" ")
  for j in 0...2 {
    bingo_card.append(split[j])
  }
}

let numOfNumbers = Int(readLine()!)!

for i in 0...numOfNumbers-1 {
  numbers.append(readLine()!)
}

for i in 0...bingo_card.count-1 {
  var status = false
  for j in 0...numbers.count-1 {
    if numbers[j] == bingo_card[i] {
      status = true
    }
  }
  
  bingo_status.append(status)
}

if bingo_status[0] && bingo_status[1] && bingo_status[2] {
  print("Yes")
} else if bingo_status[3] && bingo_status[4] && bingo_status[5] {
  print("Yes")
} else if bingo_status[6] && bingo_status[7] && bingo_status[8] {
  print("Yes")
} else if bingo_status[0] && bingo_status[3] && bingo_status[6] {
  print("Yes")
} else if bingo_status[1] && bingo_status[4] && bingo_status[7] {
  print("Yes")
} else if bingo_status[2] && bingo_status[5] && bingo_status[8] {
  print("Yes")
} else if bingo_status[0] && bingo_status[4] && bingo_status[8] {
  print("Yes")
} else if bingo_status[2] && bingo_status[4] && bingo_status[6] {
  print("Yes")
} else {
  print("No")
}
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}



func main() {
    var card = [[Int]]()
    for _ in 0..<3 {
        card.append(readInts())
    }
    let n = Int(readLine()!)!
    
    //b入力用のループ
    for _ in 1...n {
        let b = Int(readLine()!)!
        // b探索用ループ
        for i in 0..<3 {
            for j in 0..<3 {
                card[i][j] = card[i][j] == b ? 0: card[i][j]
            }
        }
    }
    print(card)
    for i in 0..<3 {
        // 横のビンゴ
        if card[i] == [0, 0, 0,] {
            print("Yes")
            return
        }
        var count = 0
        // 縦のビンゴ
        for j in 0..<3 {
        
            count += card[j][i] == 0 ? 1: 0
        }
        if count == 3 {
            print("Yes")
            return
        }
    }
    // 斜めのビンゴ(真ん中が空いていないとビンゴしないためチェック)
    if card[1][1] == 0 {
        if card[0][0] == 0 && card[2][2] == 0 || card[0][2] == 0 && card[2][0] == 0 {
            print("Yes")
            return
        }
    }
    print("No")
    
}

main()
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}



func main() {
    var card = [[Int]]()
    for _ in 0..<3 {
        card.append(readInts())
    }
    let n = Int(readLine()!)!
    
    //b入力用のループ
    for _ in 1...n {
        let b = Int(readLine()!)!
        // b探索用ループ
        for i in 0..<3 {
            for j in 0..<3 {
                card[i][j] = card[i][j] == b ? 0: card[i][j]
            }
        }
    }
    
    for i in 0..<3 {
        // 横のビンゴ
        if card[i] == [0, 0, 0,] {
            print("Yes")
            return
        }
        var count = 0
        // 縦のビンゴ
        for j in 0..<3 {
        
            count += card[i][j] == 0 ? 1: 0
        }
        if count == 3 {
            print("Yes")
            return
        }
    }
    // 斜めのビンゴ(真ん中が空いていないとビンゴしないためチェック)
    if card[1][1] == 0 {
        if card[0][0] == 0 && card[2][2] == 0 || card[0][2] == 0 && card[2][0] == 0 {
            print("Yes")
            return
        }
    }
    print("No")
    
}

main()
//  [swift]
import Foundation

var bingo_card: [String] = []
var numbers: [String] = []
var bingo_status: [Bool] = []

for i in 0...2 {
  let input_line = readLine()!
  let split: [String] = input_line.componentsSeparatedByString(" ")
  for j in 0...2 {
    bingo_card.append(split[j])
  }
}

print(bingo_card)

let numOfNumbers = Int(readLine()!)!

print(numOfNumbers)

for i in 0...numOfNumbers-1 {
  numbers.append(readLine()!)
}

print(numbers)

for i in 0...bingo_card.count-1 {
  var status = false
  for j in 0...numbers.count-1 {
    if numbers[j] == bingo_card[i] {
      status = true
    }
  }
  
  bingo_status.append(status)
}

print(bingo_status)

if bingo_status[0] && bingo_status[1] && bingo_status[2] {
  print("Yes")
} else if bingo_status[3] && bingo_status[4] && bingo_status[5] {
  print("Yes")
} else if bingo_status[6] && bingo_status[7] && bingo_status[8] {
  print("Yes")
} else if bingo_status[0] && bingo_status[3] && bingo_status[6] {
  print("Yes")
} else if bingo_status[1] && bingo_status[4] && bingo_status[7] {
  print("Yes")
} else if bingo_status[2] && bingo_status[5] && bingo_status[8] {
  print("Yes")
} else if bingo_status[0] && bingo_status[4] && bingo_status[8] {
  print("Yes")
} else if bingo_status[2] && bingo_status[4] && bingo_status[6] {
  print("Yes")
} else {
  print("No")
}
//  [typescript]
function Main(input) {
    const lines = input.split("\n");
    let cells = [lines.shift(), lines.shift(), lines.shift()];
    cells = cells.map(l => l.split(' '));

    const n = lines.shift();

    try {
        lines.forEach(b => {
            cells.forEach(row => {
                row.forEach((a, j) => {
                    if (a == b) {
                        row[j] = true;
                        if (row[0] === row[1] === row[2] ||
                            cells[0][j] === cells[1][j] === cells[2][j] ||
                            cells[0][0] === cells[1][1] === cells[2][2] ||
                            cells[0][2] === cells[1][1] === cells[2][0]
                        ) {
                            throw 1;
                        }
                    }
                });
            });
        });
        console.log('No');
    } catch(_) {
        console.log('Yes');
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
import { isRegExp } from "util";

class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;

  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n:number):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n:number):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
  f(roop:number, callback:any){
    for(let i=0;i<roop;i++){
      callback(i);
    }
  };
  Yes(){
    console.log('Yes');
  }
  No(){
    console.log('No');
  }
  YES(){
    console.log('YES');
  }
  NO(){
    console.log('NO');
  }
}
const m = () => {
  const o = new AtCoder();
  let obj:any ={}
  let obj2:any ={}
  for(let i=0;i<9;i++){
    obj[o.n()] = i;
  }
  // 0 1 2
  // 3 4 5
  // 6 7 8
  let n=o.n()
  for(let i=0;i<n;i++){
    let t = o.n()
    if(obj[t] !== undefined){
      
      obj2[obj[t]] = 1;
    }
  }
  if(obj2[0]&&obj2[1]&&obj2[2]
    || obj2[3]&&obj2[4]&&obj2[5]
    || obj2[6]&&obj2[7]&&obj2[8]
    || obj2[0]&&obj2[3]&&obj2[6]
    || obj2[1]&&obj2[4]&&obj2[7]
    || obj2[2]&&obj2[5]&&obj2[8]
    || obj2[0]&&obj2[4]&&obj2[8]
    || obj2[2]&&obj2[4]&&obj2[6]
    ){
      o.Yes()
    }else{
      o.No()
    }
}
m();