#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 10;
const int INF = 1e9 + 9;
const int B = 1e9 + 7;
void gg() {
  cout << "NO\n";
  exit(0);
}
int n;
string f[N];
int cnt[N], fr[N], to[N], ans[N], u[N];
map<string, int> s2i;
map<int, string> i2s;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  int sz = 0;
  for (int i = int(1); i <= int(n); ++i) {
    string s1, s2;
    cin >> s1 >> s2;
    string t1 = s1.substr(0, 3);
    string t2 = s1.substr(0, 2) + s2[0];
    if (s2i.count(t1) == 0) {
      s2i[t1] = ++sz;
      i2s[sz] = t1;
    }
    if (s2i.count(t2) == 0) {
      s2i[t2] = ++sz;
      i2s[sz] = t2;
    }
    fr[i] = s2i[t1], to[i] = s2i[t2];
    ++cnt[fr[i]];
  }
  for (int i = int(1); i <= int(n); ++i) {
    if (cnt[fr[i]] == 1) continue;
    if (u[to[i]]) gg();
    u[to[i]] = 1;
    ans[i] = to[i];
  }
  for (int it = int(1); it <= int(n); ++it) {
    bool ok = 0;
    vector<int> ne(sz + 1);
    for (int i = int(1); i <= int(n); ++i) {
      if (ans[i]) continue;
      if (u[fr[i]] && u[to[i]]) gg();
      if (!u[fr[i]]) ++ne[fr[i]];
      if (!u[to[i]]) ++ne[to[i]];
    }
    for (int i = int(1); i <= int(n); ++i) {
      if (ans[i]) continue;
      if (ne[fr[i]] == 1) {
        ok = 1;
        ans[i] = fr[i];
        u[fr[i]] = 1;
        break;
      }
      if (ne[to[i]] == 1) {
        ok = 1;
        ans[i] = to[i];
        u[to[i]] = 1;
        break;
      }
    }
    if (!ok) {
      for (int i = int(1); i <= int(n); ++i) {
        if (ans[i]) continue;
        if (u[fr[i]] && u[to[i]]) gg();
        if (!u[fr[i]]) {
          ans[i] = fr[i];
          u[fr[i]] = 1;
        }
        if (!u[to[i]]) {
          ans[i] = to[i];
          u[to[i]] = 1;
        }
      }
      break;
    }
  }
  cout << "YES\n";
  for (int i = int(1); i <= int(n); ++i) cout << i2s[ans[i]] << "\n";
  return 0;
}
