#include <bits/stdc++.h>
using namespace std;
string fo(string& s, string& city) { return s.substr(0, 3); }
string so(string& s, string& city) {
  return s.substr(0, 2) + city.substr(0, 1);
}
int h(string& x) {
  return (x[0] - 'A') + (x[1] - 'A') * 26 + (x[2] - 'A') * 26 * 26;
}
vector<pair<int, string>> ff;
vector<pair<int, string>> ss;
vector<int> nf;
vector<int> ns;
vector<bool> uf;
vector<bool> us;
vector<bool> mof;
vector<bool> mos;
vector<pair<int, string>> ans;
vector<int> ansh;
int main() {
  int n;
  cin >> n;
  nf.resize(26 * 26 * 26);
  ns.resize(26 * 26 * 26);
  uf.resize(26 * 26 * 26, true);
  us.resize(26 * 26 * 26, true);
  mof.resize(26 * 26 * 26);
  mos.resize(26 * 26 * 26);
  ansh.resize(26 * 26 * 26);
  for (int i = 0; i < n; ++i) {
    string a, b;
    cin >> a >> b;
    string f = fo(a, b);
    string s = so(a, b);
    ff.push_back(make_pair(i, f));
    ss.push_back(make_pair(i, s));
  }
  for (int i = 0; i < n; ++i) {
    string f = ff[i].second;
    string s = ss[i].second;
    nf[h(f)]++;
    ns[h(s)]++;
  }
  for (int i = 0; i < n; ++i) {
    string f = ff[i].second;
    string s = ss[i].second;
    if (nf[h(f)] > 1) mos[h(s)] = true;
    if (ns[h(s)] > 1) mof[h(f)] = true;
    if ((nf[h(f)] > 1) || (ns[h(s)] > 1)) {
      uf[h(f)] = false;
      us[h(s)] = false;
    }
  }
  for (int i = 0; i < n; ++i) {
    string f = ff[i].second;
    string s = ss[i].second;
    if ((nf[h(f)] > 1) && mof[h(f)]) {
      cout << "NO" << endl;
      return 0;
    }
    if ((ns[h(s)] > 1) && mos[h(s)]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  for (auto p : ff) {
    if (mof[h(p.second)]) {
      ans.push_back(p);
      ansh[h(p.second)]++;
    }
  }
  for (auto p : ss) {
    if (mos[h(p.second)]) {
      ans.push_back(p);
      ansh[h(p.second)]++;
    }
  }
  int amb = n - ans.size();
  bool skip = false;
  bool qqq = false;
  while (amb > 0) {
    for (int i = 0; i < n; ++i) {
      if (uf[h(ff[i].second)] && us[h(ss[i].second)]) {
        if ((ansh[h(ff[i].second)] > 0) || skip) {
          ans.push_back(ss[i]);
          ansh[h(ss[i].second)]++;
          amb--;
          uf[h(ff[i].second)] = false;
          us[h(ss[i].second)] = false;
          qqq = false;
        } else if (ansh[h(ss[i].second)] > 0) {
          ans.push_back(ff[i]);
          ansh[h(ff[i].second)]++;
          amb--;
          uf[h(ff[i].second)] = false;
          us[h(ss[i].second)] = false;
          qqq = false;
        }
      }
    }
    if (qqq) break;
    qqq = true;
    skip = true;
  }
  sort(ans.begin(), ans.end());
  cout << "YES" << endl;
  for (auto p : ans) {
    cout << p.second << endl;
  }
  return 0;
}
