#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;
  string q;
  getline(cin, q);
  pair<string, string> arr[n];
  map<string, int> m;
  for (int i = 0; i < n; ++i) {
    string s;
    getline(cin, s);
    string a = "", b = "";
    int pos = -1;
    for (int i = 0; i < ((int)s.size()); ++i) {
      if (s[i] != ' ') {
        a += s[i];
      } else {
        pos = i;
        break;
      }
    }
    for (int i = pos + 1; i < ((int)s.size()); ++i) b += s[i];
    arr[i] = make_pair(a, b);
    m[a.substr(0, 3)]++;
  }
  string ans[n];
  vector<bool> used(n, false);
  fill(ans, ans + n, "");
  set<string> s, res;
  for (int i = 0; i < n; ++i) {
    string a = arr[i].first;
    string b = arr[i].second;
    int val = m[a.substr(0, 3)];
    if (val >= 2) {
      if (res.count(a.substr(0, 2) + b.substr(0, 1))) {
        cout << "NO";
        return 0;
      } else {
        ans[i] = a.substr(0, 2) + b.substr(0, 1);
        res.insert(ans[i]);
      }
      s.insert(a.substr(0, 3));
      used[i] = true;
    }
  }
  int cnt = 0;
  do {
    cnt = 0;
    for (int i = 0; i < n; ++i) {
      if (used[i]) continue;
      string cur = arr[i].first.substr(0, 3);
      if (s.count(cur)) {
        used[i] = true;
        ++cnt;
        if (res.count(arr[i].first.substr(0, 2) + arr[i].second.substr(0, 1))) {
          cout << "NO";
          return 0;
        } else {
          ans[i] = arr[i].first.substr(0, 2) + arr[i].second.substr(0, 1);
          res.insert(ans[i]);
        }
      } else {
        if (res.count(arr[i].first.substr(0, 3))) {
          if (res.count(arr[i].first.substr(0, 2) +
                        arr[i].second.substr(0, 1))) {
            cout << "NO";
            return 0;
          } else {
            ans[i] = arr[i].first.substr(0, 2) + arr[i].second.substr(0, 1);
            used[i] = true;
            ++cnt;
            res.insert(ans[i]);
          }
        }
      }
    }
  } while (cnt != 0);
  for (int i = 0; i < n; ++i) {
    if (used[i]) continue;
    ans[i] = arr[i].first.substr(0, 3);
  }
  set<string> tmp;
  for (int i = 0; i < n; ++i) tmp.insert(ans[i]);
  if (((int)tmp.size()) != n) {
    cout << "NO";
  } else {
    cout << "YES" << endl;
    for (int i = 0; i < n; ++i) cout << ans[i] << endl;
  }
  return 0;
}
