func_code_string: #include <bits/stdc++.h>   using namespace std;   string s1(const pair<string, string> &x) { return x.first.substr(0, 3); }   string s2(const pair<string, string> &x) {     return x.first.substr(0, 2) + x.second.substr(0, 1);   }   const int MAXN = 1050;   vector<int> g[MAXN], mt;   int used[MAXN];   bool dfs(const int &v, const int &now) {     if (used[v] == now) return false;     used[v] = now;     for (auto to : g[v]) {       if (mt[to] == -1 || dfs(mt[to], now)) {         mt[to] = v;         return true;       }     }     return false;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     int n;     cin >> n;     vector<pair<string, string>> a(n);     for (int i = 0; i < n; ++i) {       cin >> a[i].first >> a[i].second;     }     map<string, int> str_idx;     map<string, bool> banned;     vector<string> idx_str;     for (char c1 =  A ; c1 <=  Z ; ++c1) {       for (char c2 =  A ; c2 <=  Z ; ++c2) {         for (char c3 =  A ; c3 <=  Z ; ++c3) {           string name =   ;           name += c1;           name += c2;           name += c3;           str_idx[name] = idx_str.size();           idx_str.emplace_back(name);         }       }     }     vector<bool> precalced(n);     for (int i = 0; i < n; ++i) {       for (int j = i + 1; j < n; ++j) {         if (s1(a[i]) == s1(a[j])) {           precalced[i] = precalced[j] = true;         }       }     }     int cnt = 0;     for (int i = 0; i < n; ++i) {       if (precalced[i]) {         string name = s2(a[i]);         if (banned[name]) {           cout <<  NO ;           return 0;         }         ++cnt;         banned[name] = true;       }     }     for (int i = 0; i < n; ++i) {       if (!precalced[i]) {         string name1 = s1(a[i]);         string name2 = s2(a[i]);         if (!banned[name1]) {           g[i].emplace_back(str_idx[name1]);         }         if (!banned[name2]) {           g[i].emplace_back(str_idx[name2]);         }       }     }     mt.resize(30 * 30 * 30, -1);     for (int i = 0; i < n; ++i) {       if (!precalced[i]) dfs(i, i + 1);     }     for (int i = 0; i < 30 * 30 * 30; ++i) {       if (mt[i] != -1) ++cnt;     }     if (cnt == n) {       cout <<  YES n ;       vector<string> ans(n);       for (int i = 0; i < n; ++i) {         if (precalced[i]) ans[i] = s2(a[i]);       }       for (int i = 0; i < 30 * 30 * 30; ++i) {         if (mt[i] != -1) ans[mt[i]] = idx_str[i];       }       for (auto s : ans) cout << s <<   n ;     } else {       cout <<  NO n ;     }     return 0;   }   