#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int ele[maxn];
vector<int> ss[maxn];
pair<string, string> str[maxn];
int num[maxn];
map<string, int> con;
int n;
bool dfs(int u) {
  if (u > n) return true;
  string aa;
  int ff = 0;
  if (num[u] == 0 && !con[str[u].first]) {
    num[u] = 1;
    con[str[u].first] = 1;
    if (dfs(u + 1)) ff = 1;
    con[str[u].first] = 0;
  }
  if (ff) return true;
  if (!con[str[u].second]) {
    num[u] = 2;
    con[str[u].second] = 1;
    if (dfs(u + 1)) ff = 1;
    con[str[u].second] = 0;
  }
  if (ff) return true;
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> str[i].first >> str[i].second;
    str[i].first = str[i].first.substr(0, 3);
    string a1 = str[i].first.substr(0, 2);
    a1 += str[i].second[0];
    str[i].second = a1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (str[i].first == str[j].first) num[i] = num[j] = 2;
    }
  }
  int ff = 1;
  for (int i = 1; i <= n; i++)
    if (num[i] == 2) {
      if (con[str[i].second]) {
        ff = 0;
        break;
      }
      con[str[i].second] = 1;
    }
  if (ff == 0)
    cout << "NO" << endl;
  else {
    con.clear();
    ff = dfs(1);
    if (ff) {
      cout << "YES" << endl;
      for (int i = 1; i <= n; i++) {
        if (num[i] == 1)
          cout << str[i].first << endl;
        else {
          cout << str[i].second << endl;
        }
      }
    } else
      cout << "NO" << endl;
  }
  return 0;
}
