#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000 + 10;
map<string, int> mp1;
map<string, int> mp2;
map<string, int> mp3;
string s[MAXN];
string s1[MAXN], s2[MAXN];
string s3[MAXN], s4[MAXN];
int main() {
  int n;
  while (cin >> n) {
    mp1.clear();
    mp2.clear();
    mp3.clear();
    for (int i = 1; i <= n; i++) {
      s[i] = "";
      s3[i] = "";
      s4[i] = "";
      cin >> s1[i] >> s2[i];
      s4[i] += s1[i][0];
      s4[i] += s1[i][1];
      s4[i] += s1[i][2];
      s3[i] += s1[i][0];
      s3[i] += s1[i][1];
      s3[i] += s2[i][0];
      mp1[s4[i]]++;
      mp1[s3[i]]++;
    }
    int flag = 0;
    for (int i = 1; i <= n; i++) {
      if (mp1[s4[i]] <= 1 && mp2[s3[i]] <= 1) {
        if (!mp3[s4[i]]) {
          s[i] += s4[i];
          mp3[s4[i]]++;
        } else if (!mp3[s3[i]]) {
          s[i] += s3[i];
          mp3[s3[i]]++;
        } else {
          flag = 1;
          break;
        }
      } else if (mp1[s4[i]] > 1) {
        if (!mp3[s3[i]]) {
          s[i] += s3[i];
          mp3[s3[i]]++;
        } else {
          flag = 1;
          break;
        }
      }
    }
    if (flag)
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
      for (int i = 1; i <= n; i++) {
        cout << s[i] << endl;
      }
    }
  }
}
