#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<string> v(n), w(n);
  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    string s, t;
    cin >> s >> t;
    v[i] = s.substr(0, 3);
    w[i] = t.substr(0, 3);
    mp[v[i]]++;
  }
  set<string> used;
  vector<string> ret(n, "");
  for (int i = 0; i < n; i++) {
    if (mp[v[i]] > 1) {
      string cur = v[i].substr(0, 2) + w[i].substr(0, 1);
      if (used.find(cur) != used.end()) {
        cout << "NO" << endl;
        return 0;
      }
      used.insert(cur);
      ret[i] = cur;
    }
  }
  for (int i = 0; i < n; i++) {
    if (ret[i].empty()) {
      string s = v[i].substr(0, 2) + w[i].substr(0, 1), t = v[i].substr(0, 3);
      if (used.find(s) != used.end() && used.find(t) != used.end()) {
        cout << "NO" << endl;
        return 0;
      }
      if (used.find(s) == used.end())
        ret[i] = s, used.insert(s);
      else if (used.find(t) == used.end())
        ret[i] = t, used.insert(t);
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) cout << ret[i] << endl;
  return 0;
}
