#include <bits/stdc++.h>
using namespace std;
map<string, int> u, c;
int main() {
  int i, n;
  cin >> n;
  vector<string> t;
  for (i = 1; i <= n; i++) {
    string ans, a, b;
    cin >> a >> b;
    a = a.substr(0, 3);
    b = a.substr(0, 2) + b.substr(0, 1);
    if (!u[b]) {
      u[b] = 1;
      ans = b;
    } else {
      if (u[a] || c[a]) {
        puts("NO");
        return 0;
      } else {
        u[a] = 1;
        ans = a;
      }
    }
    c[a] = 1;
    t.push_back(ans);
  }
  puts("YES");
  vector<string>::iterator s;
  for (s = t.begin(); s != t.end(); s++) cout << *s << endl;
  return 0;
}
