#include <bits/stdc++.h>
using namespace std;
struct node {
  string first, second, s;
  int id;
} src[1010];
int n;
map<string, int> mpfirst, mpsecond, xin;
bool cmp(struct node a, struct node b) {
  return mpfirst[a.first] > mpfirst[b.first];
}
bool cmp1(struct node a, struct node b) { return xin[a.first] > xin[b.first]; }
bool cmp2(struct node a, struct node b) { return a.id < b.id; }
int judge(int x) {
  sort(src + x, src + n, cmp1);
  if (xin[src[x].first] == 0) return x;
  for (; x < n; x++) {
    if (xin[src[x].first] == 1) {
      if (xin[src[x].second] == 1) return -1;
      src[x].s = src[x].second;
      xin[src[x].s] = 1;
    } else
      break;
  }
  return judge(x);
}
bool solve() {
  int i = 0;
  for (; i < n; i++) {
    if (mpfirst[src[i].first] > 1) {
      if (mpsecond[src[i].second] == 1)
        return false;
      else {
        src[i].s = src[i].second;
        mpsecond[src[i].s] = 1;
        xin[src[i].s] = 1;
      }
    } else
      break;
  }
  i = judge(i);
  if (i == -1) return false;
  for (; i < n; i++) {
    src[i].s = src[i].first;
  }
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> src[i].first >> src[i].second;
    src[i].id = i;
    src[i].second = src[i].first.substr(0, 2) + src[i].second[0];
    src[i].first = src[i].first.substr(0, 3);
    mpfirst[src[i].first]++;
  }
  sort(src, src + n, cmp);
  bool flag = solve();
  if (flag) {
    printf("YES\n");
    sort(src, src + n, cmp2);
    for (int i = 0; i < n; i++) {
      cout << src[i].s << endl;
    }
  } else {
    printf("NO\n");
  }
  return 0;
}
