#include <bits/stdc++.h>
using namespace std;
const int MIN = 1e3 + 2;
const int MXN = 1e3 + 3;
const int INF = 1e9 + 7;
const double EPS = 1e-9;
const long long LINF = 1e18 + 15;
int n;
vector<int> g[MXN];
pair<string, string> a[MXN];
map<string, int> used, used2;
map<string, bool> used3;
vector<pair<string, bool> > b[MXN];
string s, t, ans[MXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    ans[i] = "";
    cin >> a[i].first >> a[i].second;
    s = a[i].first.substr(0, 3);
    t = a[i].first.substr(0, 2) + a[i].second.substr(0, 1);
    used[s]++;
  }
  for (int i = 1; i <= n; ++i) {
    s = a[i].first.substr(0, 3);
    t = a[i].first.substr(0, 2) + a[i].second.substr(0, 1);
    if (used[s] == 1) b[i].push_back(make_pair(s, 0));
    b[i].push_back(make_pair(t, 1));
    if ((int)b[i].size() == 0) {
      cout << "NO";
      return 0;
    }
  }
  for (int k = 1; k <= n; ++k) {
    for (int i = 1; i <= n; ++i) {
      if (ans[i] != "") continue;
      int x = 0, id = -1;
      for (int j = 0; j < b[i].size(); ++j) {
        if (!used3[b[i][j].first]) x++, id = j;
      }
      if (id == -1) {
        cout << "NO";
        return 0;
      }
      if (x == 1) {
        used3[b[i][id].first] = 1;
        ans[i] = b[i][id].first;
      }
    }
  }
  for (int k = 1; k <= n; ++k) {
    for (int i = 1; i <= n; ++i) {
      if (ans[i] != "") continue;
      for (int j = 0; j < b[i].size(); ++j) {
        if (!used3[b[i][j].first]) {
          used3[b[i][j].first] = 1;
          ans[i] = b[i][j].first;
          break;
        }
      }
    }
  }
  cout << "YES\n";
  for (int i = 1; i <= n; ++i) {
    cout << ans[i] << "\n";
  }
  return 0;
}
