#include <bits/stdc++.h>
using namespace std;
map<string, bool> cant, used;
int main() {
  int n;
  cin >> n;
  vector<string> selectedShorts;
  for (int i = 0; i < n; i++) {
    string a, b;
    cin >> a >> b;
    string shortOp1 = a.substr(0, 3);
    string shortOp2 = a.substr(0, 2) + b[0];
    if (!used.count(shortOp2)) {
      used[shortOp2] = true;
      cant[shortOp1] = true;
      selectedShorts.push_back(shortOp2);
    } else {
      if (used.count(shortOp1) || cant.count(shortOp1)) {
        cout << "NO\n";
        return 0;
      }
      used[shortOp1] = true;
      selectedShorts.push_back(shortOp1);
    }
  }
  cout << "YES\n";
  for (const auto &selectedShort : selectedShorts) {
    cout << selectedShort << '\n';
  }
  return 0;
}
