#include <bits/stdc++.h>
using namespace std;
char s1[25], s2[25];
char s[1005][2][5];
map<string, vector<int> > mp1, mp2;
int ans[1005];
set<string> ss;
int main() {
  int n;
  bool f;
  scanf("%d", &n);
  f = true;
  for (int i = 1; i <= n; i++) {
    scanf("%s%s", s1, s2);
    s[i][0][0] = s1[0];
    s[i][0][1] = s1[1];
    s[i][0][2] = s1[2];
    s[i][1][0] = s1[0];
    s[i][1][1] = s1[1];
    s[i][1][2] = s2[0];
    mp1[s[i][0]].push_back(i);
    mp2[s[i][1]].push_back(i);
    if (mp1[s[i][0]].size() > 1) f = false;
  }
  if (f) {
    printf("YES\n");
    for (int i = 1; i <= n; i++) printf("%s\n", s[i][0]);
    return 0;
  }
  for (int i = 1; i <= n; i++)
    if (!ans[i]) {
      if (mp1[s[i][0]].size() > 1) {
        for (int j = 0; j < mp1[s[i][0]].size(); j++) ans[mp1[s[i][0]][j]] = 1;
      }
      if (mp2[s[i][0]].size()) {
        for (int j = 0; j < mp2[s[i][0]].size(); j++) ans[mp2[s[i][0]][j]] = 1;
        ans[i] = 1;
      }
    }
  for (int i = 1; i <= n; i++) ss.insert(s[i][ans[i]]);
  if (ss.size() == n) {
    printf("YES\n");
    for (int i = 1; i <= n; i++) printf("%s\n", s[i][ans[i]]);
  } else
    printf("NO\n");
  return 0;
}
