#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  cin.get();
  vector<pair<string, string> > a(n);
  unordered_map<string, list<int> > m;
  for (int i = 0; i < n; ++i) {
    string &s1 = a[i].first, &s2 = a[i].second;
    getline(cin, s1);
    s2 = s1.substr(0, 2) + s1[s1.find(' ') + 1];
    s1 = s1.substr(0, 3);
    m[s1].push_back(i);
    a[i] = make_pair(s1, s2);
  }
  bool was = true;
  while (was) {
    was = false;
    for (auto it = m.begin(); it != m.end();) {
      if (it->second.size() > 1) {
        was = true;
        pair<string, int> q2;
        for (auto it1 = it->second.begin(); it1 != it->second.end(); ++it1) {
          if (a[*it1].first == it->first) {
            if (a[*it1].second == a[*it1].first) {
              if (!q2.first.empty()) {
                cout << "NO\n";
                return 0;
              }
              q2.first = a[*it1].second;
              q2.second = *it1;
            } else
              m[a[*it1].second].push_back(*it1);
          } else {
            if (!q2.first.empty()) {
              cout << "NO\n";
              return 0;
            }
            q2.first = a[*it1].second;
            q2.second = *it1;
          }
        }
        it = m.erase(it);
        if (!q2.first.empty()) m[q2.first].push_back(q2.second);
      } else
        ++it;
    }
  }
  cout << "YES\n";
  vector<string> ans(n);
  for (auto it = m.begin(); it != m.end(); ++it)
    ans[*(it->second.begin())] = it->first;
  for (int i = 0; i < n; ++i) cout << ans[i] << endl;
  return 0;
}
