#include <bits/stdc++.h>
using namespace std;
int main() {
  unordered_set<string> us;
  vector<string> arr;
  bool fir, sec;
  fir = sec = true;
  int n;
  cin >> n;
  pair<string, string> hole[n];
  for (int i = 0; i < n; i++) cin >> hole[i].first >> hole[i].second;
  for (int i = 0; i < n; i++) {
    string a = hole[i].first.substr(0, 2);
    string b = hole[i].second.substr(0, 1);
    a += b;
    if (us.find(a) != us.end()) {
      fir = false;
      break;
    }
    us.insert(a);
    arr.push_back(a);
  }
  if (fir) {
    cout << "YES\n";
    for (string s : arr) cout << s << '\n';
  } else {
    us.clear();
    arr.clear();
    for (int i = 0; i < n; i++) {
      string a = hole[i].first.substr(0, 3);
      if (us.find(a) != us.end()) {
        sec = false;
        break;
      }
      us.insert(a);
      arr.push_back(a);
    }
    if (sec) {
      cout << "YES\n";
      for (string s : arr) cout << s << '\n';
    } else
      return cout << "NO", 0;
  }
}
