#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005;
map<string, int> m1;
map<string, int> m2;
map<string, int> m3;
string a[maxn], b[maxn], ans[maxn];
int main() {
  int n;
  scanf("%d", &n);
  string c = "", d = "";
  for (int i = 1; i <= n; i++) {
    c = "";
    d = "";
    cin >> a[i] >> b[i];
    c += a[i][0];
    c += a[i][1];
    c += a[i][2];
    d += a[i][0];
    d += a[i][1];
    d += b[i][0];
    if (m1[d]) {
      if (m1[c] || m2[c]) {
        printf("NO\n");
        return 0;
      }
      ans[i] = c;
    } else {
      ans[i] = d;
      m1[d] = 1;
    }
    m2[c] = 1;
  }
  puts("YES");
  for (int i = 1; i <= n; i++) cout << ans[i] << endl;
}
