#include <bits/stdc++.h>
using namespace std;
const int N = 1010, Mod = 998244353;
int n, flag;
map<string, int> m1, m2;
string s1, s2;
vector<string> ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    cin >> s1 >> s2;
    string F = s1.substr(0, 2) + s2[0];
    string L = s1.substr(0, 3);
    if (!m2[F]) {
      ans.push_back(F), m2[F] = 1, m1[F] = 3;
      if (m1[L] == 1)
        flag = 1;
      else
        m1[L] = 2;
    } else if (!m1[L])
      ans.push_back(L), m1[L] = 1, m2[L] = 3;
    else
      flag = 1;
  }
  if (flag) {
    cout << "NO\n";
    return 0;
  } else {
    cout << "YES\n";
    for (int i = 0; i < ans.size(); i++) cout << ans[i] << endl;
  }
  return 0;
}
