#include <bits/stdc++.h>
using namespace std;
struct Team {
  char a;
  char b;
  int index;
};
string *teams;
Team makeTeam(char a, char b, int index) {
  Team t;
  t.a = a;
  t.b = b;
  t.index = index;
  return t;
}
char getChar(Team t, bool changed) {
  if (changed) return t.b;
  return t.a;
}
int main() {
  int n = 0;
  cin >> n;
  teams = new string[n];
  vector<Team> names[300][300];
  string s[2 * n];
  for (int i = 0; i < 2 * n; i++) cin >> s[i];
  for (int i = 0; i < 2 * n; i += 2)
    names[s[i][0]][s[i][1]].push_back(makeTeam(s[i][2], s[i + 1][0], i / 2));
  for (int i = 0; i < 300; i++) {
    for (int j = 0; j < 300; j++) {
      if (names[i][j].size() == 0) continue;
      if (names[i][j].size() > 26) {
        cout << "NO\n";
        return 0;
      }
      vector<bool> changed(names[i][j].size(), false);
      for (int a = 0; a < names[i][j].size(); a++) {
        for (int x = 0; x < names[i][j].size(); x++) {
          for (int y = x + 1; y < names[i][j].size(); y++) {
            if (getChar(names[i][j][x], changed[x]) ==
                getChar(names[i][j][y], changed[y])) {
              if (changed[x] && changed[y]) {
                cout << "NO\n";
                return 0;
              }
              changed[x] = true;
              changed[y] = true;
              for (int ha = 0; ha < names[i][j].size(); ha++) {
                if (ha == x) continue;
                if (getChar(names[i][j][x], false) ==
                    getChar(names[i][j][ha], changed[ha])) {
                  if (!changed[ha]) {
                    changed[ha] = true;
                  }
                }
              }
              for (int ha = 0; ha < names[i][j].size(); ha++) {
                if (ha == y) continue;
                if (getChar(names[i][j][y], false) ==
                    getChar(names[i][j][ha], changed[ha])) {
                  if (!changed[ha]) {
                    changed[ha] = true;
                  }
                }
              }
            }
          }
        }
      }
      for (int x = 0; x < names[i][j].size(); x++) {
        teams[names[i][j][x].index] += ((char)(i));
        teams[names[i][j][x].index] += ((char)(j));
        teams[names[i][j][x].index] += getChar(names[i][j][x], changed[x]);
      }
    }
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) cout << teams[i] << '\n';
  return 0;
}
