#include <bits/stdc++.h>
using namespace std;
const int maxn = 1009;
int n;
string s1, s2;
map<string, bool> mp;
struct node {
  string f, s;
  int id, ans;
} a[maxn];
bool cop(node q, node w) { return q.id < w.id; }
bool sss(node q, node w) {
  if (q.f != w.f) return q.f < w.f;
  return q.s < w.s;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> s1 >> s2;
    a[i].f = s1.substr(0, 3);
    a[i].s = s1.substr(0, 2) + s2[0];
    a[i].id = i, a[i].ans = 0;
  }
  sort(a + 1, a + 1 + n, sss);
  for (int i = 2; i <= n; i++) {
    if (a[i].f == a[i - 1].f) {
      if (a[i].s == a[i - 1].s) {
        cout << "NO";
        return 0;
      }
      a[i].ans = a[i - 1].ans = 2;
      mp[a[i].s] = mp[a[i - 1].s] = 1;
    }
  }
  bool ok = 1;
  while (ok) {
    ok = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i].ans) continue;
      bool &t = mp[a[i].f];
      bool &tt = mp[a[i].s];
      if (t) {
        if (!tt) {
          a[i].ans = 2;
          tt = 1;
          ok = 1;
        } else {
          cout << "NO";
          return 0;
        }
      }
    }
  }
  cout << "YES\n";
  sort(a + 1, a + 1 + n, cop);
  for (int i = 1; i <= n; i++) {
    if (a[i].ans == 2)
      cout << a[i].s << endl;
    else
      cout << a[i].f << endl;
  }
}
