#include <bits/stdc++.h>
using namespace std;
int n;
map<string, int> m;
string a, b, x[110000], y[110000];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    x[i] = a.substr(0, 2) + b[0];
    y[i] = a.substr(0, 3);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) m[x[j]]++;
    for (int j = 1; j <= n; j++)
      if (m[x[j]] > 1) x[j] = y[j];
    m.clear();
  }
  for (int i = 1; i <= n; i++) {
    m[x[i]]++;
    if (m[x[i]] > 1) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  for (int i = 1; i <= n; i++) cout << x[i] << endl;
  return 0;
}
