#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
const int MAXN = 2e3 + 7;
int n;
string ch[MAXN][2];
vector<int> g[MAXN];
inline int neg(int u) { return (u > n ? u - n : n + u); }
inline void eadd(int u, int v) { g[u].push_back(v); }
inline void iadd(int u, int v) {
  eadd(u, v);
  eadd(neg(v), neg(u));
}
bool mk[MAXN];
int dt[MAXN], cmp[MAXN], t = 0, cc = 0;
stack<int> stk;
int scc(int u) {
  stk.push(u);
  mk[u] = true;
  int lw = dt[u] = ++t;
  for (auto v : (g[u])) {
    if (!dt[v]) {
      int nl = scc(v);
      lw = min(lw, nl);
    } else if (mk[v])
      lw = min(lw, dt[v]);
  }
  mk[u] = false;
  if (dt[u] == lw) {
    ++cc;
    while (stk.top() != u) {
      cmp[stk.top()] = cc;
      if (cmp[neg(stk.top())] == cc) return -1;
      stk.pop();
    }
    if (cmp[neg(stk.top())] == cc) return -1;
    cmp[stk.top()] = cc;
    stk.pop();
  }
  return lw;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = (1); i <= (n); ++i) {
    string s0, s1;
    cin >> s0 >> s1;
    ch[i][0] = s0.substr(0, 3);
    ch[i][1] = s0.substr(0, 2) + s1.substr(0, 1);
  }
  for (int i = (1); i <= (n); ++i)
    for (int j = (1); j <= (n); ++j)
      if (i != j) {
        if (ch[i][0] == ch[j][0]) iadd(i, neg(j)), iadd(neg(i), neg(j));
        ;
        if (ch[i][1] == ch[j][1]) iadd(neg(i), j);
        if (ch[i][0] == ch[j][1]) iadd(i, j);
      }
  for (int i = (1); i <= (2 * n); ++i)
    if (!dt[i])
      if (scc(i) < 0) {
        cout << "NO\n";
        return 0;
      }
  cout << "YES\n";
  for (int i = (1); i <= (n); ++i) {
    if (cmp[i] > cmp[neg(i)])
      cout << ch[i][1] << '\n';
    else
      cout << ch[i][0] << '\n';
  }
  return 0;
}
