func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX_N = 1000, INDEX = 1;   int n, type[MAX_N + INDEX];   string team[MAX_N + INDEX], city[MAX_N + INDEX];   bool isUsed[MAX_N + INDEX];   void get(int ind) {     isUsed[ind] = true;     for (int i = 1; i <= n; i++) {       if (i != ind) {         if (team[i][0] == team[ind][0] && team[i][1] == team[ind][1] &&             team[i][2] == city[ind][0]) {           type[i] = 1;           if (!isUsed[i]) {             get(i);           }         }       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie();     cout.tie();     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> team[i] >> city[i];     }     for (int i = 1; i <= n; i++) {       for (int j = i + 1; j <= n; j++) {         if (team[i][0] == team[j][0] && team[i][1] == team[j][1] &&             team[i][2] == team[j][2]) {           type[i] = 1, type[j] = 1;         }       }     }     for (int i = 1; i <= n; i++) {       if (type[i] == 1 && !isUsed[i]) {         get(i);       }     }     for (int i = 1; i <= n; i++) {       for (int j = i + 1; j <= n; j++) {         if (team[i][0] == team[j][0] && team[i][1] == team[j][1]) {           if (team[i][2] == team[j][2] && type[i] == 0 && type[j] == 0) {             cout <<  NO  << endl;             return 0;           }           if (team[i][2] == city[j][0] && type[i] == 0 && type[j] == 1) {             cout <<  NO  << endl;             return 0;           }           if (city[i][0] == team[j][2] && type[i] == 1 && type[j] == 0) {             cout <<  NO  << endl;             return 0;           }           if (city[i][0] == city[j][0] && type[i] == 1 && type[j] == 1) {             cout <<  NO  << endl;             return 0;           }         }       }     }     cout <<  YES  << endl;     for (int i = 1; i <= n; i++) {       if (type[i] == 0) {         cout << team[i][0] << team[i][1] << team[i][2] <<   n ;       }       if (type[i] == 1) {         cout << team[i][0] << team[i][1] << city[i][0] <<   n ;       }     }     return 0;   }   