#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e3;
char s[25], a[MaxN + 5][2][4];
bool ans[MaxN + 5], flag;
map<string, pair<int, int> > mp;
void Solve(int i) {
  ans[i] = true;
  pair<int, int> x = mp[a[i][1]];
  if (x.first == -1)
    flag = false;
  else if (x.first == -2)
    Solve(x.second);
  mp[a[i][1]].first = -1;
  return;
}
int main() {
  int n;
  flag = true;
  scanf("%d", &n);
  mp.clear();
  for (int i = 1; i <= n; ++i) {
    scanf(" %s", s);
    a[i][0][0] = a[i][1][0] = s[0];
    a[i][0][1] = a[i][1][1] = s[1];
    a[i][0][2] = s[2];
    scanf(" %s", s);
    a[i][1][2] = s[0];
    a[i][0][3] = a[i][1][3] = '\0';
    ++mp[a[i][0]].first;
  }
  pair<int, int> x;
  for (int i = 1; i <= n && flag; ++i) {
    x = mp[a[i][0]];
    if (x.first == 1) {
      x.first = -2;
      x.second = i;
      mp[a[i][0]] = x;
      ans[i] = false;
    } else
      Solve(i);
  }
  if (flag) {
    printf("YES\n");
    for (int i = 1; i <= n; ++i) printf("%s\n", ans[i] ? a[i][1] : a[i][0]);
  } else
    printf("NO\n");
  return 0;
}
