#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tt = 1;
  while (tt--) {
    long long n;
    cin >> n;
    string a[n], b[n], t1, t2;
    for (int i = 0; i < n; i++) {
      cin >> a[i] >> b[i];
    }
    map<string, vector<long long> > check;
    string fir[n], sec[n], ans[n];
    for (int i = 0; i < n; i++) {
      t1 = a[i][0];
      t1 += a[i][1];
      t1 += a[i][2];
      t2 = a[i][0];
      t2 += a[i][1];
      t2 += b[i][0];
      fir[i] = t1;
      sec[i] = t2;
      ans[i] = fir[i];
      check[t1].push_back(i);
    }
    set<string> used;
    for (auto &it : check) {
      if (it.second.size() == 1) continue;
      for (int i = 0; i < (it.second).size(); i++) {
        ans[(it.second)[i]] = sec[(it.second)[i]];
        used.insert(ans[it.second[i]]);
      }
    }
    for (int i = 0; i < n; i++) {
      if (used.count(ans[i])) {
        ans[i] = sec[i];
      }
    }
    set<string> dist;
    for (int i = 0; i < n; i++) {
      dist.insert(ans[i]);
    }
    if (dist.size() != n) {
      dist.clear();
      check.clear();
      used.clear();
      for (int i = 0; i < n; i++) {
        ans[i] = sec[i];
        check[sec[i]].push_back(i);
      }
      for (auto &it : check) {
        if ((it.second).size() == 1) continue;
        for (int i = 0; i < (it.second).size(); i++) {
          ans[(it.second)[i]] = fir[(it.second)[i]];
          used.insert(ans[it.second[i]]);
        }
      }
      for (int i = 0; i < n; i++) {
        if (used.count(ans[i])) {
          ans[i] = fir[i];
        }
      }
      for (int i = 0; i < n; i++) {
        dist.insert(ans[i]);
      }
      if (dist.size() != n) {
        cout << "NO\n";
        return 0;
      }
    }
    cout << "YES\n";
    for (int i = 0; i < n; i++) {
      cout << ans[i] << '\n';
    }
  }
}
