#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
static void amax(T &x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
static void amin(T &x, U y) {
  if (x > y) x = y;
}
int main() {
  int n;
  unordered_map<string, int> ban, used;
  scanf("%d", &n);
  vector<string> ans(n);
  for (int i = 0; i < (n); i++) {
    string u, v, a, b;
    cin >> u >> v;
    a = u.substr(0, 3);
    b = u.substr(0, 2) + v[0];
    if (!used[b]) {
      used[b]++;
      ban[a]++;
      ans[i] = b;
    } else {
      if (used[a] || ban[a]) return printf("NO\n"), 0;
      used[a]++;
      ans[i] = a;
    }
  }
  printf("YES\n");
  for (auto x : ans) cout << x << endl;
  return 0;
}
