Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
int n,a,b,c,x;
  x=0;
  string s,t;
  cin>>n>>a>>b>>c;
  if(a==0&&b==0&&c==0){cout<<"No"<<endl;}
  if((a>=1&&b>=1&&c>=1)||(a>=2&&b>=1&&c==0)||(a==0&&b>=1&&c>=2)
    ||(a==0&&b>=2&&c>=1)||(a>=1&&b==0&&c>=2)||(a>=1&&b>=2&&c==0)
    ||(a>=2&&b==0&&c>=1)){
  cout<<"Yes"<<endl;
    for(int i=0;i<n;i++){
    cin>>s;
      if(s=="AB"){if(a>=b){cout<<"A"<<endl; a--; b++;}
                  if(a<b){cout<<"B"<<endl; b--; a++;}}
      if(s=="AC"){if(a>=c){cout<<"A"<<endl; a--; c++;}
                  if(a<c){cout<<"C"<<endl; c--; a++;}}
      if(s=="BC"){if(b>=c){cout<<"B"<<endl; b--; c++;}
                  if(b<c){cout<<"C"<<endl; c--; b++;}}
   }
    }

  if((a==0&&b==0&&c>=3)||(a==0&&c==0&&b>=3)||(c==0&&b==0&&a>=3)){
  cin>>s;
    if(s=="AB"){if(a==0&&b==0){cout<<"No"<<endl;}
               else{
              for(int i=0;i<n;i++){
                cout<<"Yes"<<endl;
    cin>>s;
      if(s=="AB"){if(a>=b){cout<<"A"<<endl; a--; b++;}
                  if(a<b){cout<<"B"<<endl; b--; a++;}}
      if(s=="AC"){if(a>=c){cout<<"A"<<endl; a--; c++;}
                  if(a<c){cout<<"C"<<endl; c--; a++;}}
      if(s=="BC"){if(b>=c){cout<<"B"<<endl; b--; c++;}
               if(b<c){cout<<"C"<<endl; c--; b++;}}}}
    if(s=="AC"){if(a==0&&c==0){cout<<"No"<<endl;}
               else{for(int i=0;i<n;i++){
                 cout<<"Yes"<<endl;
    cin>>s;
      if(s=="AB"){if(a>=b){cout<<"A"<<endl; a--; b++;}
                  if(a<b){cout<<"B"<<endl; b--; a++;}}
      if(s=="AC"){if(a>=c){cout<<"A"<<endl; a--; c++;}
                  if(a<c){cout<<"C"<<endl; c--; a++;}}
      if(s=="BC"){if(b>=c){cout<<"B"<<endl; b--; c++;}
                 if(b<c){cout<<"C"<<endl; c--; b++;}}}}
    if(s=="BC"){if(b==0&&c==0){cout<<"No"<<endl;}
               else{for(int i=0;i<n;i++){
                 cout<<"Yes"<<endl;
    cin>>s;
      if(s=="AB"){if(a>=b){cout<<"A"<<endl; a--; b++;}
                  if(a<b){cout<<"B"<<endl; b--; a++;}}
      if(s=="AC"){if(a>=c){cout<<"A"<<endl; a--; c++;}
                  if(a<c){cout<<"C"<<endl; c--; a++;}}
      if(s=="BC"){if(b>=c){cout<<"B"<<endl; b--; c++;}
                 if(b<c){cout<<"C"<<endl; c--; b++;}}}}
  }
     if((a==0&&b==0&&c==1)||(a==0&&c==0&&b==1)||(c==0&&b==0&&a==1)) {
     for(int i=0;i<n;i++){
       vector<string> vec(n);
    cin>>s;
      if(s=="AB"){if(a==0&&b==0){cout<<"No"<<endl; break; x=1;}
                  else if(a>=b){vec.at(i)="A"; a--; b++;}
                  else if(a<b){vec.at(i)"B"; b--; a++;}}
      if(s=="AC"){if(a==0&&c==0){cout<<"No"<<endl; break; x=1;}
                  else if(a>=c){vec.at(i)="A"; a--; c++;}
                  else if(a<c){vec.at(i)="C"; c--; a++;}}
      if(s=="BC"){if(c==0&&b==0){cout<<"No"<<endl; break; x=1;}
                  else if(b>=c){vec.at(i)="B"; b--; c++;}
                  else if(b<c){vec.at(i)="C"; c--; b++;}}
     if(x==0){
     cout<<"Yes"<<endl;
     for(int i=0;i<n;i++){
     cout<<vec.at(i)<<endl;}}         
     }}
                
                
    if((a==0&&b==1&&c==1)||(a==1&&c==0&&b==1)||(c==1&&b==0&&a==1)){
    cin>>s;
    }            
     }                         
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:41: error: expected ';' before string constant
   65 |                   else if(a<b){vec.at(i)"B"; b--; a++;}}
      |                                         ^~~
      |                                         ;
a.cc:65:38: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; reference = std::__cxx11::basic_string<char>&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   65 |                   else if(a<b){vec.at(i)"B"; b--; a++;}}
      |                                ~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1180:7: note: declared here
 1180 |       at(size_type __n)
      |       ^~
a.cc:83:2: error: expected '}' at end of input
   83 | }
      |  ^
a.cc:25:65: note: to match this '{'
   25 |   if((a==0&&b==0&&c>=3)||(a==0&&c==0&&b>=3)||(c==0&&b==0&&a>=3)){
      |                                                                 ^
a.cc:83:2: error: expected '}' at end of input
   83 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^