#include <bits/stdc++.h>
const int N = 200001;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  pair<string, string> a[1000];
  map<string, int> d;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    ++d[a[i].first.substr(0, 3)];
  }
  vector<pair<pair<int, string>, int>> b, nex;
  string ans[n];
  for (int i = 0; i < n; i++) {
    if (d[a[i].first.substr(0, 3)] > 1) {
      b.push_back(
          make_pair(make_pair(1, a[i].first.substr(0, 2) + a[i].second[0]), i));
      ans[i] = a[i].first.substr(0, 2) + a[i].second[0];
    } else {
      b.push_back(make_pair(make_pair(0, a[i].first.substr(0, 3)), i));
      ans[i] = a[i].first.substr(0, 3);
    }
  }
  for (int t = 0; t < n; t++) {
    d.clear();
    nex.clear();
    for (auto &e : b) {
      ++d[e.first.second];
    }
    for (int i = 0; i < n; i++) {
      string ss = b[i].first.second;
      if (d[ss] > 1 && b[i].first.first == 0) {
        nex.push_back(make_pair(
            make_pair(1, a[i].first.substr(0, 2) + a[i].second[0]), i));
      } else {
        nex.push_back(b[i]);
      }
    }
    b = nex;
  }
  d.clear();
  for (auto &e : b) {
    ++d[e.first.second];
  }
  if (d.size() < n) {
    cout << "NO";
    return 0;
  }
  cout << "YES\n";
  for (auto &e : b) {
    cout << e.first.second << '\n';
  }
}
