stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cstring>

#include<string>

#include<algorithm>

#include<queue>

#include<stack>

#include<vector>

#include<set>

#include<map>

using namespace std;

typedef long long ll;

int main()

{

    int s[5][5];

    for(int i=1; i<=3; i++)

    {

        for(int j=1; j<=3; j++)

        {

            cin>>s[i][j];

        }

    }

    int n;

    int b[5][5]= {0};

    cin>>n;

    while(n--)

    {

        int x;

        cin>>x;

        for(int i=1; i<=3; i++)

        {

            int ff=0;

            for(int j=1; j<=3; j++)

            {

                if(s[i][j]==x&&b[i][j]==0)

                {

                    b[i][j]=1;

                    ff=1;

                    break;

                }

            }

            if(ff==1)

                break;

        }

    }

    int flag=0;

    for(int i=1;i<=3;i++)

    {

        if(b[i][1]==1&&b[i][2]==1&&b[i][3]==1)

        {flag=1;break;}

        if(b[1][i]==1&&b[2][i]==1&&b[3][i]==1)

        {flag=1;break;}

    }

    if(b[1][1]==1&&b[2][2]==1&&b[3][3]==1)

        flag=1;

    if(b[1][3]==1&&b[2][2]==1&&b[3][1]==1)

        flag=1;

    if(flag==1)

        cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.265868108789902x):
#include <stdio.h>



int main(){

	

	int matrix[3][3];

	int bingo [3][3] = {0};

	

	for(int i=0; i<3; i++){

		for(int j=0; j<3; j++){

			scanf("%d", &matrix[i][j]);

		}

	}

	

	int N;

	scanf("%d", &N);

	

	for(int k=0; k<N; k++){

		int a;

		scanf("%d", &a);

		for(int i= 0; i<3; i++){

			for(int j = 0; j<3; j++){

				if(matrix[i][j] == a){

					bingo[i][j] = 1;

				}

			}

		}

	}

	

	if(bingo[0][0] + bingo[1][1] + bingo[2][2] == 3 || bingo[0][2] +bingo[1][1] +bingo[2][0] == 3){

		printf("Yes\n");

		return 0;

	}for(int i = 0; i < 3;i++){

	if(bingo[i][0]+bingo[i][1]+bingo[i][2]==3||bingo[0][i]+bingo[1][i]+bingo[2][i]== 3){

		printf("Yes\n");

		return 0;

	}

}

printf("No\n");	

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

using namespace std;

int a[5][5];

int b[15];

int ans=0,t=0,teil=0,head=0;

int main()

{

	int n;

	for(int i=1;i<=3;i++)

	{

		for(int j=1;j<=3;j++)

		{

			cin>>a[i][j];

		}

	}

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>b[i];

	}

	for(int i=1;i<=3;i++)

	{

		ans=0;

		t=0;

		for(int j=1;j<=3;j++)

		{

			for(int k=1;k<=n;k++)

			{

				if(a[i][j]==b[k])

				{

					ans++;

				}

				if(a[j][i]==b[k])

				{

					t++;

				}

			}

		}

		if(ans==3||t==3) break;

	}

	for(int i=1;i<=3;i++)

	{

		for(int j=1;j<=n;j++)

		{

			if(a[i][i]==b[j])

			{

				teil++;

			}

			if(a[4-i][i]==b[j])

			{

				head++;

			}

		}

	}

	if(teil==3||head==3||ans==3||t==3) cout<<"Yes"<<endl;

	else cout<<"No"<<endl;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.2668340061305186x):
#include <stdio.h>



int main(){

	

	int matrix[3][3];

	int bingo [3][3] = {0};

	

	for(int i=0; i<3; i++){

		for(int j=0; j<3; j++){

			scanf("%d", &matrix[i][j]);

		}

	}

	

	int N;

	scanf("%d", &N);

	

	for(int k=0; k<N; k++){

		int a;

		scanf("%d", &a);

		for(int i= 0; i<3; i++){

			for(int j = 0; j<3; j++){

				if(matrix[i][j] == a){

					bingo[i][j] = 1;

				}

			}

		}

	}

	

	if(bingo[0][0] + bingo[1][1] + bingo[2][2] == 3 || bingo[0][2] +bingo[1][1] +bingo[2][0] == 3){

		printf("Yes\n");

		return 0;

	}for(int i = 0; i < 3;i++){

	if(bingo[i][0]+bingo[i][1]+bingo[i][2]==3||bingo[0][i]+bingo[1][i]+bingo[2][i]== 3){

		printf("Yes\n");

		return 0;

	}

}

printf("No\n");	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){

    int arr[3][3];

    for (int i=0;i<3;i++){

        for (int j=0;j<3;j++){

            cin>>arr[i][j];

        }

    }

    int t,stop=0,win=0;

    cin>>t;

    for (int k=0;k<t;k++){

        int b;

        cin>>b;

    for (int i=0;i<3;i++){

        for (int j=0;j<3;j++){

            if (arr[i][j]==b)

                arr[i][j]=-1;

            }

        }

    }

        for (int i=0;i<3;i++){

        if (arr[i][0]==arr[i][1] and arr[i][1]==arr[i][2] and arr[i][2]==-1)

            win =1;

        else if (arr[0][i]==arr[1][i] and arr[1][i]==arr[2][i] and arr[2][i]==-1)

            win =1;

     }

    if (arr[0][0]==arr[1][1] and arr[1][1]==arr[2][2] and arr[2][2]==-1)

            win=1;

    if (arr[0][2]==arr[1][1] and arr[1][1]==arr[2][0] and arr[2][0]==-1)

            win=1;

    if (win){

         cout<<"Yes";

         return 0;

    }

    cout<<"No"<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.265566912600995x):
#include <stdio.h>



int main(){

	

	int matrix[3][3];

	int bingo [3][3] = {0};

	

	for(int i=0; i<3; i++){

		for(int j=0; j<3; j++){

			scanf("%d", &matrix[i][j]);

		}

	}

	

	int N;

	scanf("%d", &N);

	

	for(int k=0; k<N; k++){

		int a;

		scanf("%d", &a);

		for(int i= 0; i<3; i++){

			for(int j = 0; j<3; j++){

				if(matrix[i][j] == a){

					bingo[i][j] = 1;

				}

			}

		}

	}

	

	if(bingo[0][0] + bingo[1][1] + bingo[2][2] == 3 || bingo[0][2] +bingo[1][1] +bingo[2][0] == 3){

		printf("Yes\n");

		return 0;

	}for(int i = 0; i < 3;i++){

	if(bingo[i][0]+bingo[i][1]+bingo[i][2]==3||bingo[0][i]+bingo[1][i]+bingo[2][i]== 3){

		printf("Yes\n");

		return 0;

	}

}

printf("No\n");	

	return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <queue>

#include <cmath>

#include <algorithm>

#include <iostream>

#include <set>

#include <map>

#include <string>

#include <algorithm>

using namespace std;

#include <string>

#include <cstdio>

#define ll long long

#define TLE std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

typedef pair<int,int> pii;

const ll mod = 1000000007 ;

const int INF=0x3f3f3f3f;

#define test(n) cout<<"Test "<<n<<endl;

#define pb push_back

#define rp(n) for(int i=1;i<=n;i++)

#define rep(n,m) for(int i=1;i<=n;i++) for(int j=1;j<=m;j++)

ll ksm(ll x,ll n){ll ans=1;while (n){if (n&1)ans=(ans*x)%mod;x=x*x%mod;n>>=1;}return ans;}

using namespace std;

double pi = atan(1.0)*4 ;

const int mxn = 1e3+7 ;

int n,t,m,k,l,r;

/// ll mat[mxn][mxn], prime[mxn], isprime[mxn];

ll phi[mxn];

string str;char ch[27][27] ;

int a[mxn][mxn];

ll exgcd(ll a,ll b, ll &x ,ll &y)

{

    if(!a&&!b) return -1;/// 无最大公约数

    if(!b) {x=1,y=0;return a;}

    ll d=exgcd(b,a%b,y,x);

    y-=a/b*x ;

    return d;

}

int vis[mxn][mxn];

int main()

{



    rep(3,3) vis[i][j] = 0 ;

    map<int,pair<int,int> >mp;

    rep(3,3) {cin>>a[i][j];mp[ a[i][j] ] = {i,j} ;}

    cin>>n;

    rp(n){ cin>>k;pair<int,int>tmp = mp[k];



    if(mp.find(k)!=mp.end() && tmp.first<=3 && tmp.second<=3 && tmp.first>0 && tmp.second>0)

        vis[ tmp.first ][ tmp.second ] = 1 ;

    }

    int f1 = 0 ;

    for(int i=1;i<=3;i++)

    {

        int ans = 0 ;

        for(int j=1;j<=3;j++)

            if(vis[i][j]==1)

                ans++;

        if(ans==3) {cout<<"Yes"<<endl;f1=1;break;}

    }

    if(!f1)

    {

        if(vis[1][1]&&vis[2][2]&&vis[3][3] || vis[1][3]&&vis[2][2]&&vis[3][1])

            {cout<<"Yes"<<endl;f1=1;}

    }

    if(!f1)

    {

        for(int i=1;i<=3;i++)

        {

            int ans = 0 ;

            for(int j=1;j<=3;j++)

                if(vis[j][i]==1)

                    ans++;

            if(ans==3) {cout<<"Yes"<<endl;f1=1;break;}

        }

    }

    if(!f1) cout<<"No"<<endl;

}




// Faster C++ solution for the same problem (measured speedup: 5.338335357296251x):
#include <stdio.h>



int main() {

	int trix1[4][4], Zx, Xy;

		for (int u = 0; u < 3; u++) {

			for (int i = 0; i < 3; i++) {

				scanf("%d", &trix1[u][i]);

			}

		}

		int trix2[4][4] = {};

		scanf("%d", &Zx);

		for(int o = 0; o < Zx; o++) {

			scanf("%d", &Xy);

			for (int u = 0; u < 3; u++) {

				for (int i = 0; i < 3; i++) {

					if (Xy == trix1[u][i]) {

						trix2[u][i]++;

					  	if ((trix2[0][0] > 0 && trix2[0][1] > 0 && trix2[0][2] > 0) || (trix2[1][0] > 0 && trix2[1][1] > 0 && trix2[1][2] > 0) || (trix2[2][0] > 0 && trix2[2][1] > 0 && trix2[2][2] > 0) || (trix2[0][0] > 0 && trix2[1][0] > 0 && trix2[2][0] > 0) || (trix2[0][1] > 0 && trix2[1][1] > 0 && trix2[2][1] > 0) || (trix2[0][2] > 0 && trix2[1][2] > 0 && trix2[2][2] > 0) || (trix2[0][2] > 0 && trix2[1][1] > 0 && trix2[2][0] > 0) || (trix2[0][0] > 0 && trix2[1][1] > 0 && trix2[2][2] > 0)) {

					  		printf("Yes\n");

					  		return 0;

					  	}

					}

				}

			}

		}

	printf("No\n");

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cstring>

#include<string>

#include<algorithm>

#include<queue>

#include<stack>

#include<vector>

#include<set>

#include<map>

using namespace std;

typedef long long ll;

int main()

{

    int s[5][5];

    for(int i=1; i<=3; i++)

    {

        for(int j=1; j<=3; j++)

        {

            cin>>s[i][j];

        }

    }

    int n;

    int b[5][5]= {0};

    cin>>n;

    while(n--)

    {

        int x;

        cin>>x;

        for(int i=1; i<=3; i++)

        {

            int ff=0;

            for(int j=1; j<=3; j++)

            {

                if(s[i][j]==x&&b[i][j]==0)

                {

                    b[i][j]=1;

                    ff=1;

                    break;

                }

            }

            if(ff==1)

                break;

        }

    }

    int flag=0;

    for(int i=1;i<=3;i++)

    {

        if(b[i][1]==1&&b[i][2]==1&&b[i][3]==1)

        {flag=1;break;}

        if(b[1][i]==1&&b[2][i]==1&&b[3][i]==1)

        {flag=1;break;}

    }

    if(b[1][1]==1&&b[2][2]==1&&b[3][3]==1)

        flag=1;

    if(b[1][3]==1&&b[2][2]==1&&b[3][1]==1)

        flag=1;

    if(flag==1)

        cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.263047735304645x):
#include <stdio.h>



int main() {

	int trix1[4][4], Zx, Xy;

		for (int u = 0; u < 3; u++) {

			for (int i = 0; i < 3; i++) {

				scanf("%d", &trix1[u][i]);

			}

		}

		int trix2[4][4] = {};

		scanf("%d", &Zx);

		for(int o = 0; o < Zx; o++) {

			scanf("%d", &Xy);

			for (int u = 0; u < 3; u++) {

				for (int i = 0; i < 3; i++) {

					if (Xy == trix1[u][i]) {

						trix2[u][i]++;

					  	if ((trix2[0][0] > 0 && trix2[0][1] > 0 && trix2[0][2] > 0) || (trix2[1][0] > 0 && trix2[1][1] > 0 && trix2[1][2] > 0) || (trix2[2][0] > 0 && trix2[2][1] > 0 && trix2[2][2] > 0) || (trix2[0][0] > 0 && trix2[1][0] > 0 && trix2[2][0] > 0) || (trix2[0][1] > 0 && trix2[1][1] > 0 && trix2[2][1] > 0) || (trix2[0][2] > 0 && trix2[1][2] > 0 && trix2[2][2] > 0) || (trix2[0][2] > 0 && trix2[1][1] > 0 && trix2[2][0] > 0) || (trix2[0][0] > 0 && trix2[1][1] > 0 && trix2[2][2] > 0)) {

					  		printf("Yes\n");

					  		return 0;

					  	}

					}

				}

			}

		}

	printf("No\n");

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

using namespace std;

int a[5][5];

int b[15];

int ans=0,t=0,teil=0,head=0;

int main()

{

	int n;

	for(int i=1;i<=3;i++)

	{

		for(int j=1;j<=3;j++)

		{

			cin>>a[i][j];

		}

	}

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>b[i];

	}

	for(int i=1;i<=3;i++)

	{

		ans=0;

		t=0;

		for(int j=1;j<=3;j++)

		{

			for(int k=1;k<=n;k++)

			{

				if(a[i][j]==b[k])

				{

					ans++;

				}

				if(a[j][i]==b[k])

				{

					t++;

				}

			}

		}

		if(ans==3||t==3) break;

	}

	for(int i=1;i<=3;i++)

	{

		for(int j=1;j<=n;j++)

		{

			if(a[i][i]==b[j])

			{

				teil++;

			}

			if(a[4-i][i]==b[j])

			{

				head++;

			}

		}

	}

	if(teil==3||head==3||ans==3||t==3) cout<<"Yes"<<endl;

	else cout<<"No"<<endl;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.2640131153153185x):
#include <stdio.h>



int main() {

	int trix1[4][4], Zx, Xy;

		for (int u = 0; u < 3; u++) {

			for (int i = 0; i < 3; i++) {

				scanf("%d", &trix1[u][i]);

			}

		}

		int trix2[4][4] = {};

		scanf("%d", &Zx);

		for(int o = 0; o < Zx; o++) {

			scanf("%d", &Xy);

			for (int u = 0; u < 3; u++) {

				for (int i = 0; i < 3; i++) {

					if (Xy == trix1[u][i]) {

						trix2[u][i]++;

					  	if ((trix2[0][0] > 0 && trix2[0][1] > 0 && trix2[0][2] > 0) || (trix2[1][0] > 0 && trix2[1][1] > 0 && trix2[1][2] > 0) || (trix2[2][0] > 0 && trix2[2][1] > 0 && trix2[2][2] > 0) || (trix2[0][0] > 0 && trix2[1][0] > 0 && trix2[2][0] > 0) || (trix2[0][1] > 0 && trix2[1][1] > 0 && trix2[2][1] > 0) || (trix2[0][2] > 0 && trix2[1][2] > 0 && trix2[2][2] > 0) || (trix2[0][2] > 0 && trix2[1][1] > 0 && trix2[2][0] > 0) || (trix2[0][0] > 0 && trix2[1][1] > 0 && trix2[2][2] > 0)) {

					  		printf("Yes\n");

					  		return 0;

					  	}

					}

				}

			}

		}

	printf("No\n");

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){

    int arr[3][3];

    for (int i=0;i<3;i++){

        for (int j=0;j<3;j++){

            cin>>arr[i][j];

        }

    }

    int t,stop=0,win=0;

    cin>>t;

    for (int k=0;k<t;k++){

        int b;

        cin>>b;

    for (int i=0;i<3;i++){

        for (int j=0;j<3;j++){

            if (arr[i][j]==b)

                arr[i][j]=-1;

            }

        }

    }

        for (int i=0;i<3;i++){

        if (arr[i][0]==arr[i][1] and arr[i][1]==arr[i][2] and arr[i][2]==-1)

            win =1;

        else if (arr[0][i]==arr[1][i] and arr[1][i]==arr[2][i] and arr[2][i]==-1)

            win =1;

     }

    if (arr[0][0]==arr[1][1] and arr[1][1]==arr[2][2] and arr[2][2]==-1)

            win=1;

    if (arr[0][2]==arr[1][1] and arr[1][1]==arr[2][0] and arr[2][0]==-1)

            win=1;

    if (win){

         cout<<"Yes";

         return 0;

    }

    cout<<"No"<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.262746700434961x):
#include <stdio.h>



int main() {

	int trix1[4][4], Zx, Xy;

		for (int u = 0; u < 3; u++) {

			for (int i = 0; i < 3; i++) {

				scanf("%d", &trix1[u][i]);

			}

		}

		int trix2[4][4] = {};

		scanf("%d", &Zx);

		for(int o = 0; o < Zx; o++) {

			scanf("%d", &Xy);

			for (int u = 0; u < 3; u++) {

				for (int i = 0; i < 3; i++) {

					if (Xy == trix1[u][i]) {

						trix2[u][i]++;

					  	if ((trix2[0][0] > 0 && trix2[0][1] > 0 && trix2[0][2] > 0) || (trix2[1][0] > 0 && trix2[1][1] > 0 && trix2[1][2] > 0) || (trix2[2][0] > 0 && trix2[2][1] > 0 && trix2[2][2] > 0) || (trix2[0][0] > 0 && trix2[1][0] > 0 && trix2[2][0] > 0) || (trix2[0][1] > 0 && trix2[1][1] > 0 && trix2[2][1] > 0) || (trix2[0][2] > 0 && trix2[1][2] > 0 && trix2[2][2] > 0) || (trix2[0][2] > 0 && trix2[1][1] > 0 && trix2[2][0] > 0) || (trix2[0][0] > 0 && trix2[1][1] > 0 && trix2[2][2] > 0)) {

					  		printf("Yes\n");

					  		return 0;

					  	}

					}

				}

			}

		}

	printf("No\n");

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cstring>

#include<string>

#include<algorithm>

#include<queue>

#include<stack>

#include<vector>

#include<set>

#include<map>

using namespace std;

typedef long long ll;

int main()

{

    int s[5][5];

    for(int i=1; i<=3; i++)

    {

        for(int j=1; j<=3; j++)

        {

            cin>>s[i][j];

        }

    }

    int n;

    int b[5][5]= {0};

    cin>>n;

    while(n--)

    {

        int x;

        cin>>x;

        for(int i=1; i<=3; i++)

        {

            int ff=0;

            for(int j=1; j<=3; j++)

            {

                if(s[i][j]==x&&b[i][j]==0)

                {

                    b[i][j]=1;

                    ff=1;

                    break;

                }

            }

            if(ff==1)

                break;

        }

    }

    int flag=0;

    for(int i=1;i<=3;i++)

    {

        if(b[i][1]==1&&b[i][2]==1&&b[i][3]==1)

        {flag=1;break;}

        if(b[1][i]==1&&b[2][i]==1&&b[3][i]==1)

        {flag=1;break;}

    }

    if(b[1][1]==1&&b[2][2]==1&&b[3][3]==1)

        flag=1;

    if(b[1][3]==1&&b[2][2]==1&&b[3][1]==1)

        flag=1;

    if(flag==1)

        cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.256200748238304x):
#include <stdio.h>

#include <string.h>

int main(){

    

    int arr[3][3]={0};

    for(int i=0;i<3;i++){

        for(int j=0;j<3;j++){

            scanf("%d", &arr[i][j]);

        }

    }

    int N;

    scanf("%d", &N);

    int matrix[N]={0};

    

    for (int k=0;k<N;k++){

        scanf("%d", &matrix[k]);

        for(int l=0;l<3;l++){

            for(int m=0;m<3;m++){

                if(matrix[k] == arr[l][m]){

                    arr[l][m] = 0;

                }

            }

        }

    }

    if(arr[0][0]==0 && arr[0][1]==0 && arr[0][2]==0){

        printf("Yes");

    } else if(arr[1][0]==0 && arr[1][1]==0 && arr[1][2]==0){

        printf("Yes");

    } else if(arr[2][0]==0 && arr[2][1]==0 && arr[2][2]==0){

        printf("Yes");

    } else if(arr[0][0]==0 && arr[1][0]==0 && arr[2][0]==0){

        printf("Yes");

    } else if(arr[0][1]==0 && arr[1][1]==0 && arr[2][1]==0){

        printf("Yes");

    } else if(arr[0][2]==0 && arr[1][2]==0 && arr[2][2]==0){

        printf("Yes");

    } else if(arr[0][0]==0 && arr[1][1]==0 && arr[2][2]==0){

        printf("Yes");

    } else if(arr[0][2]==0 && arr[1][1]==0 && arr[2][0]==0){

        printf("Yes");

    } else {

        printf("No");    

    }

    

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

using namespace std;

int a[5][5];

int b[15];

int ans=0,t=0,teil=0,head=0;

int main()

{

	int n;

	for(int i=1;i<=3;i++)

	{

		for(int j=1;j<=3;j++)

		{

			cin>>a[i][j];

		}

	}

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>b[i];

	}

	for(int i=1;i<=3;i++)

	{

		ans=0;

		t=0;

		for(int j=1;j<=3;j++)

		{

			for(int k=1;k<=n;k++)

			{

				if(a[i][j]==b[k])

				{

					ans++;

				}

				if(a[j][i]==b[k])

				{

					t++;

				}

			}

		}

		if(ans==3||t==3) break;

	}

	for(int i=1;i<=3;i++)

	{

		for(int j=1;j<=n;j++)

		{

			if(a[i][i]==b[j])

			{

				teil++;

			}

			if(a[4-i][i]==b[j])

			{

				head++;

			}

		}

	}

	if(teil==3||head==3||ans==3||t==3) cout<<"Yes"<<endl;

	else cout<<"No"<<endl;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.257164872333245x):
#include <stdio.h>

#include <string.h>

int main(){

    

    int arr[3][3]={0};

    for(int i=0;i<3;i++){

        for(int j=0;j<3;j++){

            scanf("%d", &arr[i][j]);

        }

    }

    int N;

    scanf("%d", &N);

    int matrix[N]={0};

    

    for (int k=0;k<N;k++){

        scanf("%d", &matrix[k]);

        for(int l=0;l<3;l++){

            for(int m=0;m<3;m++){

                if(matrix[k] == arr[l][m]){

                    arr[l][m] = 0;

                }

            }

        }

    }

    if(arr[0][0]==0 && arr[0][1]==0 && arr[0][2]==0){

        printf("Yes");

    } else if(arr[1][0]==0 && arr[1][1]==0 && arr[1][2]==0){

        printf("Yes");

    } else if(arr[2][0]==0 && arr[2][1]==0 && arr[2][2]==0){

        printf("Yes");

    } else if(arr[0][0]==0 && arr[1][0]==0 && arr[2][0]==0){

        printf("Yes");

    } else if(arr[0][1]==0 && arr[1][1]==0 && arr[2][1]==0){

        printf("Yes");

    } else if(arr[0][2]==0 && arr[1][2]==0 && arr[2][2]==0){

        printf("Yes");

    } else if(arr[0][0]==0 && arr[1][1]==0 && arr[2][2]==0){

        printf("Yes");

    } else if(arr[0][2]==0 && arr[1][1]==0 && arr[2][0]==0){

        printf("Yes");

    } else {

        printf("No");    

    }

    

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){

    int arr[3][3];

    for (int i=0;i<3;i++){

        for (int j=0;j<3;j++){

            cin>>arr[i][j];

        }

    }

    int t,stop=0,win=0;

    cin>>t;

    for (int k=0;k<t;k++){

        int b;

        cin>>b;

    for (int i=0;i<3;i++){

        for (int j=0;j<3;j++){

            if (arr[i][j]==b)

                arr[i][j]=-1;

            }

        }

    }

        for (int i=0;i<3;i++){

        if (arr[i][0]==arr[i][1] and arr[i][1]==arr[i][2] and arr[i][2]==-1)

            win =1;

        else if (arr[0][i]==arr[1][i] and arr[1][i]==arr[2][i] and arr[2][i]==-1)

            win =1;

     }

    if (arr[0][0]==arr[1][1] and arr[1][1]==arr[2][2] and arr[2][2]==-1)

            win=1;

    if (arr[0][2]==arr[1][1] and arr[1][1]==arr[2][0] and arr[2][0]==-1)

            win=1;

    if (win){

         cout<<"Yes";

         return 0;

    }

    cout<<"No"<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.25590010500137x):
#include <stdio.h>

#include <string.h>

int main(){

    

    int arr[3][3]={0};

    for(int i=0;i<3;i++){

        for(int j=0;j<3;j++){

            scanf("%d", &arr[i][j]);

        }

    }

    int N;

    scanf("%d", &N);

    int matrix[N]={0};

    

    for (int k=0;k<N;k++){

        scanf("%d", &matrix[k]);

        for(int l=0;l<3;l++){

            for(int m=0;m<3;m++){

                if(matrix[k] == arr[l][m]){

                    arr[l][m] = 0;

                }

            }

        }

    }

    if(arr[0][0]==0 && arr[0][1]==0 && arr[0][2]==0){

        printf("Yes");

    } else if(arr[1][0]==0 && arr[1][1]==0 && arr[1][2]==0){

        printf("Yes");

    } else if(arr[2][0]==0 && arr[2][1]==0 && arr[2][2]==0){

        printf("Yes");

    } else if(arr[0][0]==0 && arr[1][0]==0 && arr[2][0]==0){

        printf("Yes");

    } else if(arr[0][1]==0 && arr[1][1]==0 && arr[2][1]==0){

        printf("Yes");

    } else if(arr[0][2]==0 && arr[1][2]==0 && arr[2][2]==0){

        printf("Yes");

    } else if(arr[0][0]==0 && arr[1][1]==0 && arr[2][2]==0){

        printf("Yes");

    } else if(arr[0][2]==0 && arr[1][1]==0 && arr[2][0]==0){

        printf("Yes");

    } else {

        printf("No");    

    }

    

    return 0;

}