#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int t, n, m, a[3005] = {0};
string ans[3005];
vector<pair<string, int> > v[3005];
map<string, int> mp;
map<int, string> mp1;
vector<string> v1[3005];
int F(int x, int vis[]) {
  int i, i1, i2, idx;
  for (i = 0; i < v1[x].size(); i++) {
    string s = v1[x][i];
    i1 = mp[s];
    if (!vis[i1]) {
      vis[i1] = 1;
      if (a[i1] < 0 || F(a[i1], vis)) {
        a[i1] = x;
        ans[x] = s;
        return 1;
      }
    }
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int i, j, k, x, y, vis[3005] = {0};
  string s1, s2;
  cin >> n;
  int cc = 1;
  memset(a, -1, sizeof a);
  for (i = 0; i < n; i++) {
    cin >> s1 >> s2;
    string temp = s1.substr(0, 3), temp1 = s1.substr(0, 2) + s2[0];
    if (mp[temp] == 0) mp[temp] = cc++;
    if (mp[temp1] == 0) mp[temp1] = cc++;
    v[mp[temp]].push_back({temp1, i});
    mp1[mp[temp]] = temp;
  }
  for (i = 1; i < cc; i++) {
    s2 = mp1[i];
    if (v[i].size() == 1) {
      k = v[i][0].second;
      s1 = v[i][0].first;
      v1[k].push_back(s1);
      v1[k].push_back(s2);
      continue;
    }
    for (j = 0; j < v[i].size(); j++) {
      s1 = v[i][j].first;
      k = v[i][j].second;
      v1[k].push_back(s1);
    }
  }
  m = mp.size();
  for (i = 0; i < n; i++) {
    for (j = 0; j < m + 2; j++) vis[j] = 0;
    if (F(i, vis))
      continue;
    else {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES\n";
  for (i = 0; i < n; i++) cout << ans[i] << '\n';
  cerr << '\n'
       << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n";
  return 0;
}
