#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int64_t n;
  cin >> n;
  set<string> taken;
  vector<int64_t> can(n);
  vector<pair<string, string> > asks(n);
  for (int64_t i = 0; i < n; i++) {
    cin >> asks[i].first >> asks[i].second;
  }
  map<string, vector<int64_t> > cou;
  for (int64_t i = 0; i < n; i++) {
    cou[asks[i].first.substr(0, 3)].push_back(i);
  }
  vector<string> ans(n);
  for (map<string, vector<int64_t> >::iterator i = cou.begin(); i != cou.end();
       i++) {
    if ((i->second).size() != 1) {
      for (int64_t j = 0; j < (i->second).size(); j++) {
        can[(i->second)[j]] = 1;
        int64_t tmp = (i->second)[j];
        ans[tmp] =
            (asks[tmp].first.substr(0, 2) + asks[tmp].second.substr(0, 1));
        taken.insert(
            (asks[tmp].first.substr(0, 2) + asks[tmp].second.substr(0, 1)));
      }
    }
  }
  for (int64_t i = 0; i < n; i++) {
    int64_t good = 0;
    for (int64_t j = 0; j < n; j++) {
      if (can[j] == 0) {
        if (taken.count(asks[j].first.substr(0, 3))) {
          ans[j] = (asks[j].first.substr(0, 2) + asks[j].second.substr(0, 1));
          taken.insert(
              (asks[j].first.substr(0, 2) + asks[j].second.substr(0, 1)));
          can[j] = 1;
          good = 1;
          break;
        }
        if (taken.count(
                (asks[j].first.substr(0, 2) + asks[j].second.substr(0, 1)))) {
          ans[j] = asks[j].first.substr(0, 3);
          taken.insert(asks[j].first.substr(0, 3));
          can[j] = 1;
          good = 1;
          break;
        }
      }
    }
    if (good == 0) {
      for (int64_t j = 0; j < n; j++) {
        if (can[j] == 0) {
          ans[j] = (asks[j].first.substr(0, 3));
          taken.insert(asks[j].first.substr(0, 3));
          can[j] = 1;
          good = 1;
          break;
        }
      }
    }
  }
  if (taken.size() != n) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  for (int64_t i = 0; i < n; i++) {
    cout << ans[i] << endl;
  }
}
