#include <bits/stdc++.h>
using namespace std;
void FREOPEN() {
  freopen(
      ""
      ".in",
      "r", stdin);
  freopen(
      ""
      ".out",
      "w", stdout);
}
inline double Time() { return (clock() * 1.0) / CLOCKS_PER_SEC; }
const int N = 200500, inf = 1e9 * 2, MOD = 1e9 + 7;
char CH[N];
const long long INF = 1e18;
const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};
unordered_map<string, bool> was;
string f[N], s[N];
vector<int> vs;
int ans[N];
int n;
void no() {
  cout << "NO";
  exit(0);
}
string wh(int ty, int p) {
  if (ty == 1)
    return f[p];
  else
    return s[p];
}
bool dfs(int v) {
  vs.push_back(v);
  for (int u = 1; u <= n; u++) {
    if (ans[u]) continue;
    if (was[f[u]] && was[s[u]]) return 0;
    if (was[f[u]] && !was[s[u]]) {
      ans[u] = 2;
      was[s[u]] = 1;
      dfs(u);
    } else if (!was[f[u]] && was[s[u]]) {
      ans[u] = 1;
      was[f[u]] = 1;
      dfs(u);
    }
  }
  return 1;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    f[i] += s1[0];
    f[i] += s1[1];
    s[i] += f[i];
    f[i] += s1[2];
    s[i] += s2[0];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == j) continue;
      if (f[i] == f[j]) {
        ans[i] = 2;
        break;
      }
    }
    if (ans[i]) {
      if (was[s[i]]) no();
      was[s[i]] = 1;
    }
  }
  while (true) {
    bool did = 0;
    for (int i = 1; i <= n; i++) {
      if (ans[i]) continue;
      if (was[f[i]] && was[s[i]]) no();
      if (was[f[i]] && !was[s[i]])
        ans[i] = 2, was[s[i]] = 1, did = 1;
      else if (!was[f[i]] && was[s[i]])
        ans[i] = 1, was[f[i]] = 1, did = 1;
    }
    if (did) continue;
    for (int i = 1; i <= n; i++) {
      if (ans[i]) continue;
      ans[i] = 1;
      was[f[i]] = 1;
      if (!dfs(i)) {
        for (auto j : vs) ans[j] = 0, was[wh(ans[j], j)] = 0;
        ans[i] = 2;
        was[s[i]] = 1;
        if (!dfs(i)) no();
      }
    }
    break;
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) cout << wh(ans[i], i) << '\n';
  return 0;
}
