#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j;
  cin >> n;
  set<pair<string, string> > s;
  vector<string> fir;
  vector<string> sec;
  for (i = 0; i < n; i++) {
    string a, b;
    cin >> a >> b;
    string c = a.substr(0, 3);
    string d = a.substr(0, 2) + b.substr(0, 1);
    s.insert({c, d});
    fir.push_back(c);
    sec.push_back(d);
  }
  if (s.size() != n) {
    cout << "NO" << endl;
    return 0;
  }
  for (i = 0; i < n; i++) {
    int x = 0;
    for (j = i + 1; j < n; j++) {
      if (sec[i] == sec[j]) {
        x = 1;
        sec[j] = "0";
      }
    }
    if (x == 1) sec[i] = "0";
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (sec[i] == fir[j]) {
        fir[j] = "0";
      }
    }
  }
  for (i = 0; i < n; i++) {
    int x = 0;
    for (j = 0; j < n; j++) {
      if (j == i) {
        continue;
      }
      if (fir[i] == fir[j]) {
        x = 1;
        fir[j] = "0";
      }
    }
    if (x == 1) fir[i] = "0";
  }
  for (i = 0; i < n; i++) {
    if (fir[i] == "0" && sec[i] == "0") {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  for (i = 0; i < n; i++) {
    if (fir[i] != "0") {
      cout << fir[i] << endl;
    } else {
      cout << sec[i] << endl;
    }
  }
}
