Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#define pi 3.14159265358979323846264338327950

int main() {
	std::vector<std::vector<int>> A(3, std::vector<int>(3));
	for (int i = 0; i < 3; ++i)
		for (int j = 0; j < 3; ++j)
			std::cin >> A[i][j];
	int N; std::cin >> N;
	std::vector<int> B(N);
	for (auto& r : B) std::cin >> r;
	std::vector<std::vector<bool>> BOOL(3, std::vector<bool>(3));
	std::fill(BOOL.begin(), BOOL.end(), false);
	for (int n = 0; n < N; ++n) {
		for (int i = 0; i < 3; ++i)
			for (int j = 0; j < 3; ++j) {
				if (n == A[i][j])
					BOOL[i][j] = true;
			}
	}
	if ((BOOL[0][0] == true && BOOL[0][1] == true && BOOL[0][2] == true)
		|| (BOOL[1][0] == true && BOOL[1][1] == true && BOOL[1][2] == true)
		|| (BOOL[2][0] == true && BOOL[2][1] == true && BOOL[2][2] == true)
		|| (BOOL[0][0] == true && BOOL[1][0] == true && BOOL[2][0] == true)
		|| (BOOL[0][1] == true && BOOL[1][1] == true && BOOL[2][1] == true)
		|| (BOOL[0][2] == true && BOOL[1][2] == true && BOOL[2][2] == true)
		|| (BOOL[0][0] == true && BOOL[1][1] == true && BOOL[2][2] == true)
		|| (BOOL[2][0] == true && BOOL[1][1] == true && BOOL[0][2] == true))
		std::cout << "Yes" << std::endl;
	else
		std::cout << "No" << std::endl;
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = vector<bool>*; _Tp = bool; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/14/bits/stl_algobase.h:981:21:   required from 'void std::__fill_a1(__gnu_cxx::__normal_iterator<_Iterator, _Container>, __gnu_cxx::__normal_iterator<_Iterator, _Container>, const _Tp&) [with _Ite = vector<bool>*; _Cont = vector<vector<bool> >; _Tp = bool]'
  981 |     { std::__fill_a1(__first.base(), __last.base(), __value); }
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:998:21:   required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = __gnu_cxx::__normal_iterator<vector<bool>*, vector<vector<bool> > >; _Tp = bool]'
  998 |     { std::__fill_a1(__first, __last, __value); }
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1029:20:   required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<vector<bool>*, vector<vector<bool> > >; _Tp = bool]'
 1029 |       std::__fill_a(__first, __last, __value);
      |       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:18:11:   required from here
   18 |         std::fill(BOOL.begin(), BOOL.end(), false);
      |         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:952:18: error: no match for 'operator=' (operand types are 'std::vector<bool>' and 'const bool')
  952 |         *__first = __tmp;
      |         ~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/vector:67,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_bvector.h:894:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(const std::vector<bool, _Alloc>&) [with _Alloc = std::allocator<bool>]'
  894 |       operator=(const vector& __x)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:894:31: note:   no known conversion for argument 1 from 'const bool' to 'const std::vector<bool>&'
  894 |       operator=(const vector& __x)
      |                 ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_bvector.h:926:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(std::vector<bool, _Alloc>&&) [with _Alloc = std::allocator<bool>]'
  926 |       operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:926:26: note:   no known conversion for argument 1 from 'const bool' to 'std::vector<bool>&&'
  926 |       operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_bvector.h:952:7: note: candidate: 'std::vector<bool, _Alloc>& std::vector<bool, _Alloc>::operator=(std::initializer_list<bool>) [with _Alloc = std::allocator<bool>]'
  952 |       operator=(initializer_list<bool> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:952:40: note:   no known conversion for argument 1 from 'const bool' to 'std::initializer_list<bool>'
  952 |       operator=(initializer_list<bool> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~