#include <bits/stdc++.h>
using namespace std;
int n;
string name1[1000], name2[1000];
string ans[1000];
map<string, vector<int> > nm;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    char s1[30], s2[30];
    scanf(" %s %s", s1, s2);
    name1[i] = name1[i] + s1[0] + s1[1] + s1[2];
    name2[i] = name2[i] + s1[0] + s1[1] + s2[0];
    nm[name1[i]].push_back(i);
  }
  set<string> s;
  for (auto &v : nm) {
    if (v.second.size() == 1) continue;
    for (auto &vi : v.second) {
      if (s.find(name2[vi]) != s.end()) {
        cout << "NO" << endl;
        return 0;
      }
      s.insert(name2[vi]);
      ans[vi] = name2[vi];
    }
  }
  queue<string> q;
  for (auto &v : s) {
    q.push(v);
  }
  while (!q.empty()) {
    string k = q.front();
    q.pop();
    if (nm[k].size() == 1) {
      int vi = nm[k][0];
      nm[k].clear();
      if (s.find(name2[vi]) == s.end()) {
        ans[vi] = name2[vi];
        s.insert(name2[vi]);
        q.push(name2[vi]);
      } else {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  for (auto &v : nm)
    if (v.second.size() == 1) {
      int vi = v.second[0];
      ans[vi] = name1[vi];
    }
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) cout << ans[i] << endl;
  return 0;
}
