#include <bits/stdc++.h>
using namespace std;
template <typename A>
void _do(A x) {
  cerr << x << "\n";
}
template <typename A, typename... B>
void _do(A x, B... y) {
  cerr << x << ", ";
  _do(y...);
}
int n;
map<string, int> s1, s2;
string ans[1005];
string fr[1005], ba[1005];
bool dfs(string str, int x) {
  if (s2[str]) return 0;
  ans[x] = str;
  s2[str] = x;
  if (s1[str] > 0) {
    int id = s1[str];
    s1[str] = -1;
    return dfs(ba[id], id);
  } else
    return 1;
}
signed main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> fr[i] >> ba[i];
    fr[i] = fr[i].substr(0, 3);
    ba[i] = fr[i].substr(0, 2) + ba[i][0];
    if (!s1[fr[i]] && !s2[fr[i]]) {
      ans[i] = fr[i];
      s1[fr[i]] = i;
      continue;
    } else {
      bool ok = 1;
      ok &= dfs(ba[i], i);
      if (s1[fr[i]] > 0) {
        int id = s1[fr[i]];
        s1[fr[i]] = -1;
        ok &= dfs(ba[id], id);
      }
      if (!ok) {
        cout << "NO\n";
        return 0;
      }
    }
  }
  cout << "YES\n";
  for (int i = 1; i <= n; i++) cout << ans[i] << '\n';
}
