Language: C++

#include <iostream>
#include <vector>

using namespace std;


void solve(int n, int a, int b, int c, vector<string>& events){
	bool possible = true;
    vector<string> res;
    
    for(int i = 0 ; i < (int)events.size(); i++){
    	if(events[i] == "AB"){
        	if(a == 0 and b == 0){
            	possible = false;
                break;
            }
            else if(a == 1 and b == 1 and c = 0 and i != n - 1 and events[i + 1] == "BC"){
            	a -= 1;
                b += 1;
                res.push_back("B");
            }
            else if(a == 1 and b == 1 and c == 0 and i != n - 1 and events[i + 1] == "AC"){
            	a += 1;
                b -= 1;
                res.push_back("A");
            }
           else if(a > b){
           		a -= 1;
                b += 1;
                res.push_back("B");
           }
           else{ // covers a < b and a == b and a != 1.
           		a += 1;
                b -= 1;
                res.push_back("A");
           }
        }
         	if(events[i] == "BC"){
        	if(b == 0 and c == 0){
            	possible = false;
                break;
            }
            else if(b == 1 and c == 1 and a = 0 and i != n - 1 and events[i + 1] == "AB"){
            	a -= 1;
                b += 1;
                res.push_back("B");
            }
            else if(b == 1 and c == 1  and a = 0 and i != n - 1 and events[i + 1] == "AC"){
            	c += 1;
                b -= 1;
                res.push_back("C");
            }
           else if(b > c){
           		b -= 1;
                c += 1;
                res.push_back("C");
           }
           else{ // covers b < c and b == c and b != 1.
           		b += 1;
                c -= 1;
                res.push_back("B");
           }
        }
       	if(events[i] == "AC"){
        	if(a == 0 and c == 0){
            	possible = false;
                break;
            }
            else if(a == 1 and c == 1 and b == 0 and i != n - 1 and events[i + 1] == "BC"){
            	a -= 1;
                c += 1;
                res.push_back("C");
            }
            else if(a == 1 and c == 1 and b == 0 and i != n - 1 and events[i + 1] == "AB"){
                a += 1;
                c -= 1;
                res.push_back("A");
            }
           else if(a > c){
           		a -= 1;
                c += 1;
                res.push_back("C");
           }
           else{ // covers a < c and a == c and a != 1.
           		a += 1;
                c -= 1;
                res.push_back("A");
           }
        }
      
    }
  
  if(possible){
  	cout << "Yes" << endl;
    for(int i = 0; i < n; i++){
    	cout << res[i] << endl;
    }
  }
  else {
  	cout << "No" << endl;
  }
}



int main(){
	int n, a, b, c;
    cin >> n >> a >> b >> c;
    vector<string> events(n);
   	for(int i = 0; i < n; i++){
    	cin >> events[i];
    }
  
    solve(n, a, b, c, events);
  	
	return 0;
}


Compiler output:
a.cc: In function 'void solve(int, int, int, int, std::vector<std::__cxx11::basic_string<char> >&)':
a.cc:17:39: error: lvalue required as left operand of assignment
   17 |             else if(a == 1 and b == 1 and c = 0 and i != n - 1 and events[i + 1] == "BC"){
      |                     ~~~~~~~~~~~~~~~~~~^~~~~
a.cc:43:39: error: lvalue required as left operand of assignment
   43 |             else if(b == 1 and c == 1 and a = 0 and i != n - 1 and events[i + 1] == "AB"){
      |                     ~~~~~~~~~~~~~~~~~~^~~~~
a.cc:48:40: error: lvalue required as left operand of assignment
   48 |             else if(b == 1 and c == 1  and a = 0 and i != n - 1 and events[i + 1] == "AC"){
      |                     ~~~~~~~~~~~~~~~~~~~^~~~~