#include <bits/stdc++.h>
using namespace std;
int solve();
int main() { solve(); }
const int dd = (int)3000 + 1;
int ans[dd];
string name[dd];
map<string, vector<int> > M;
vector<vector<int> > E;
map<string, int> Q;
int nv = 0;
int get(string s) {
  auto it = Q.find(s);
  if (it != Q.end()) return it->second;
  name[nv] = s;
  return Q[s] = nv++;
}
int used[dd], tmm, pr[dd], prl[dd];
bool dfs(int v) {
  if (used[v] == tmm) return false;
  used[v] = tmm;
  for (int to : E[v]) {
    if (pr[to] == -1 || dfs(pr[to])) {
      pr[to] = v, prl[v] = to;
      return true;
    }
  }
  return false;
}
int solve() {
  int n;
  cin >> n;
  nv = n;
  E.resize(n);
  for (int i = 0; i < n; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    string t1 = string(s1.begin(), s1.begin() + 3);
    string t2 =
        string(s1.begin(), s1.begin() + 2) + string(s2.begin(), s2.begin() + 1);
    M[t1].push_back(i);
    E[i].push_back(get(t1));
    E[i].push_back(get(t2));
  }
  int ok = 1;
  fill(pr, pr + dd, -1);
  fill(prl, prl + dd, -1);
  for (auto c : M) {
    if (c.second.size() <= 1) continue;
    for (int x : c.second) {
      if (pr[E[x][1]] != -1) ok = 0;
      prl[x] = E[x][1];
      pr[E[x][1]] = x;
      E[x].clear();
    }
  }
  for (int i = 0; i < n; i++) {
    tmm++;
    dfs(i);
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (prl[i] != -1) cnt++;
  }
  if (ok && cnt == n) {
    puts("YES");
    for (int i = 0; i < n; i++) {
      cout << name[prl[i]] << "\n";
    }
  } else {
    puts("NO");
  }
  return 0;
}
