#include <bits/stdc++.h>
using namespace std;
static const int INF = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
template <typename T, typename U>
static void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
static void amax(T &x, U y) {
  if (x < y) x = y;
}
const int MAXN = 1100;
bool change[MAXN];
vector<string> a(MAXN), b(MAXN);
bool dfs(int p, map<string, int> &res) {
  change[p] = true;
  if (res.count(b[p]) == 0) {
    res[b[p]] = p;
    return true;
  }
  int prev = res[b[p]];
  if (change[prev]) return false;
  res[b[p]] = p;
  res.erase(a[prev]);
  return dfs(prev, res);
}
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  multiset<string> st;
  for (int(i) = 0; (i) < (int)(n); ++(i)) {
    string s1, s2;
    cin >> s1 >> s2;
    a[i] = s1.substr(0, 3);
    st.insert(a[i]);
    b[i] = s1.substr(0, 2) + s2.substr(0, 1);
  }
  map<string, int> res;
  for (int(i) = 0; (i) < (int)(n); ++(i)) {
    if (res.count(a[i]) == 0 && st.count(a[i]) == 1) {
      res[a[i]] = i;
    } else {
      if (dfs(i, res) == false) {
        cout << "NO";
        return 0;
      }
    }
  }
  cout << "YES" << endl;
  for (int(i) = 0; (i) < (int)(n); ++(i)) {
    if (change[i])
      cout << b[i] << endl;
    else
      cout << a[i] << endl;
  }
  return 0;
}
