#include <bits/stdc++.h>
using namespace std;
map<string, int> q;
map<string, string> change;
vector<string> res;
map<string, int> take_pace;
bool try_to_change(string s1) {
  if (change[s1] == "0") return 0;
  if (q[s1] == 0)
    return 1;
  else
    return try_to_change(change[s1]);
}
void changer(string s1, int i) {
  if (q[s1] == 0) {
    q[s1] = i + 1;
    change[s1] = "0";
    res[i] = s1;
  } else {
    int j = q[s1];
    changer(change[s1], j - 1);
    q[s1] = i + 1;
    change[s1] = "0";
    res[i] = s1;
  }
}
int main() {
  int n;
  cin >> n;
  vector<pair<string, string>> a, t1;
  vector<pair<pair<string, string>, int>> t2;
  for (int i = 0; i < n; ++i) {
    string s1, s2;
    cin >> s1 >> s2;
    string s3, s4;
    s3 += s1[0];
    s3 += s1[1];
    s4 = s3;
    s3 += s1[2];
    s4 += s2[0];
    a.push_back(make_pair(s3, s4));
  }
  res.assign(n, "");
  for (int i = 0; i < n; ++i) {
    bool u = 0;
    for (int j = 0; j < n; ++j) {
      if (a[i].first == a[j].first && i != j) u = 1;
    }
    if (u) {
      if (q[a[i].second]) {
        cout << "NO" << endl;
        return 0;
      }
      q[a[i].second] = i + 1;
      change[a[i].second] = "0";
      res[i] = a[i].second;
    } else {
      t2.push_back(make_pair(a[i], i));
    }
  }
  for (int i = 0; i < t2.size(); ++i) {
    if (q[t2[i].first.first] == 0) {
      q[t2[i].first.first] = t2[i].second + 1;
      res[t2[i].second] = t2[i].first.first;
      change[t2[i].first.first] = t2[i].first.second;
    } else {
      if (q[t2[i].first.second] == 0) {
        q[t2[i].first.second] = t2[i].second + 1;
        res[t2[i].second] = t2[i].first.second;
        change[t2[i].first.second] = "0";
      } else {
        if (change[t2[i].first.second] == "0") {
          cout << "NO";
          return 0;
        } else {
          if (!try_to_change(t2[i].first.second)) {
            cout << "NO";
            return 0;
          } else {
            changer(t2[i].first.second, t2[i].second);
          }
        }
      }
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; ++i) {
    cout << res[i] << endl;
  }
  return 0;
}
