#include <bits/stdc++.h>
using namespace std;
map<string, int> vis, flag;
vector<string> ans;
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    string res, a, b;
    cin >> a >> b;
    a = a.substr(0, 3);
    b = a.substr(0, 2) + b.substr(0, 1);
    if (!vis[b]) {
      vis[b] = 1;
      res = b;
    } else {
      if (vis[a] || flag[a]) {
        puts("NO");
        return 0;
      } else {
        vis[a] = 1;
        res = a;
      }
    }
    flag[a] = 1;
    ans.push_back(res);
  }
  puts("YES");
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << endl;
  return 0;
}
