#include <bits/stdc++.h>
const int N = (int)(5e5) + 322;
const int INF = (int)(1e9);
using namespace std;
int n;
string x[N], y[N], res[N];
map<string, vector<char> > M;
map<string, bool> u;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> x[i] >> y[i];
    M[x[i].substr(0, 3)].push_back(y[i][0]);
  }
  for (auto it : M) {
    set<char> S;
    for (auto to : it.second) {
      S.insert(to);
    }
    if ((int)(S.size()) != (int)(it.second.size())) {
      cout << "NO";
      return 0;
    }
  }
  for (int i = 1; i <= n; ++i) {
    if ((int)(M[x[i].substr(0, 3)].size()) > 1) {
      res[i] = x[i].substr(0, 2) + y[i][0];
      u[res[i]] = 1;
    }
  }
  for (int i = 1; i <= n; ++i) {
    if ((int)(M[x[i].substr(0, 3)].size()) == 1) {
      if (!u.count(x[i].substr(0, 2) + y[i][0])) {
        res[i] = x[i].substr(0, 2) + y[i][0];
      } else if (!u.count(x[i].substr(0, 3))) {
        res[i] = x[i].substr(0, 3);
      } else {
        cout << "NO";
        return 0;
      }
    }
    u[res[i]] = 1;
  }
  cout << "YES"
       << "\n";
  for (int i = 1; i <= n; ++i) cout << res[i] << "\n";
  return 0;
}
