Language: C++

#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 500005
#define mx 10004
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d ", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 1000000007
#define mod 1000000009
#define PI acos(-1.0)
#define eps 1e-9
#define mem(a, b) memset(a, b, sizeof(a))
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

inline int Set(int N, int pos){return N=N | (1<<pos);}
inline int Reset(int N, int pos){return N=N & ~(1<<pos);}
inline bool Check(int N, int pos){return (bool)(N & (1<<pos));}

inline void normal(ll &a) { a %= mod; (a < 0) && (a += mod); }
inline ll modMul(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a * b) % mod; }
inline ll modAdd(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a + b) % mod; }
inline ll modSub(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while (p) { if (p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, mod - 2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll fast_exp(ll x, ll n, ll m)
{
    ll res = 1;
    while(n>0)
    {
        if(n%2==1)
            res = (res * x) % m;
        x = (x * x) % m;
        n/=2;
    }
    return res%m;
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

clock_t t_Start;
void Start()
{
    t_Start = clock();
}
void End()
{
    double Time = (double)(clock()-t_Start)/CLOCKS_PER_SEC;
    error(Time);
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet;
typedef tree<int,null_type,greater<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet1;

//int Tree[MAX][26], a[MAX];

int query(int idx, int p)
{
    int sum = 0;
    while(idx>0)
    {
        sum+=Tree[idx][p];
        idx-=idx&(-idx);
    }
    return sum;
}

void update(int idx, int p, int x, int n)
{
    while(idx<=n)
    {
        Tree[idx][p]+=x;
        idx+=idx&(-idx);
    }
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //Start();

    int a[5][5];
    map<int, int>ans, mp;
    for(int i = 1; i <= 3; i++)
    {
        for(int j = 1; j <= 3; j++)
        {
            cin>>a[i][j];
        }
    }
    int n;
    cin>>n;
    for(int i = 0; i < n; i++)
    {
        int b;
        cin>>b;
        ans[b]++;
    }
    for(int i = 1; i <= 3; i++)
    {
        mp = ans;
        int tot = 0;
        for(int j = 1; j <= 3; j++)
        {
            if(mp[a[i][j]]>=1)
            {
                mp[a[i][j]]--;
                tot++;
            }
        }
        if(tot==3)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    for(int i = 1; i <= 3; i++)
    {
        mp = ans;
        int tot = 0;
        for(int j = 1; j <= 3; j++)
        {
            if(mp[a[j][i]]>=1)
            {
                mp[a[j][i]]--;
                tot++;
            }
        }
        if(tot==3)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    int tot = 0;
    for(int i = 1; i <= 3; i++)
    {
        if(ans[a[i][i]]>=1)
        {
            ans[a[i][i]]--;
            tot++;
        }
    }
    if(tot==3)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    //End();
    return 0;
}


Compiler output:
a.cc: In function 'int query(int, int)':
a.cc:80:14: error: 'Tree' was not declared in this scope; did you mean 'free'?
   80 |         sum+=Tree[idx][p];
      |              ^~~~
      |              free
a.cc: In function 'void update(int, int, int, int)':
a.cc:90:9: error: 'Tree' was not declared in this scope; did you mean 'free'?
   90 |         Tree[idx][p]+=x;
      |         ^~~~
      |         free