#include <bits/stdc++.h>
using namespace std;
struct SCC {
  vector<vector<int> > G, R, T, C;
  vector<int> vs, used, blg;
  SCC() {}
  SCC(int n) : G(n), R(n), used(n), blg(n) {}
  void add_edge(int u, int v) {
    G[u].emplace_back(v);
    R[v].emplace_back(u);
  }
  void dfs(int v) {
    used[v] = 1;
    for (int u : G[v])
      if (!used[u]) dfs(u);
    vs.emplace_back(v);
  }
  void rdfs(int v, int k) {
    used[v] = 1;
    blg[v] = k;
    C[k].emplace_back(v);
    for (int u : R[v])
      if (!used[u]) rdfs(u, k);
  }
  int build() {
    int n = G.size();
    for (int v = 0; v < n; v++)
      if (!used[v]) dfs(v);
    fill(used.begin(), used.end(), 0);
    int k = 0;
    for (int i = n - 1; i >= 0; i--) {
      if (!used[vs[i]]) {
        T.emplace_back();
        C.emplace_back();
        rdfs(vs[i], k++);
      }
    }
    for (int v = 0; v < n; v++)
      for (int u : G[v])
        if (blg[v] != blg[u]) T[blg[v]].push_back(blg[u]);
    for (int i = 0; i < k; i++) {
      sort(T[i].begin(), T[i].end());
      T[i].erase(unique(T[i].begin(), T[i].end()), T[i].end());
    }
    return k;
  }
  int operator[](int k) const { return blg[k]; };
};
struct TwoSat {
  int n;
  SCC scc;
  TwoSat(int n) : n(n), scc(n * 2) {}
  int negate(int v) { return (n + v) % (n * 2); }
  void add_if(int u, int v) {
    scc.add_edge(u, v);
    scc.add_edge(negate(v), negate(u));
  }
  void add_or(int u, int v) { add_if(negate(u), v); }
  void add_nand(int u, int v) { add_if(u, negate(v)); }
  void set_true(int v) { scc.add_edge(negate(v), v); }
  void set_false(int v) { scc.add_edge(v, negate(v)); }
  vector<int> build() {
    scc.build();
    vector<int> res(n);
    for (int i = 0; i < n; i++) {
      if (scc[i] == scc[n + i]) return {};
      res[i] = scc[i] > scc[n + i];
    }
    return res;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int> > g(2 * n);
  TwoSat ts(2 * n);
  map<string, vector<int> > mapf;
  map<string, vector<int> > mapall;
  map<int, string> ans;
  for (int i = 0; i < n; i++) {
    string s, t;
    cin >> s >> t;
    string fir = {};
    fir.push_back(s[0]);
    fir.push_back(s[1]);
    fir.push_back(s[2]);
    string sec = {};
    sec.push_back(s[0]);
    sec.push_back(s[1]);
    sec.push_back(t[0]);
    ans[i] = fir;
    ans[i + n] = sec;
    ts.add_nand(i, i + n);
    ts.add_nand(i + n, i);
    ts.add_or(i, i + n);
    auto tp = mapf[fir];
    if (tp.size() == 1) {
      ts.set_false(tp[0]);
    }
    if (tp.size() >= 1) {
      ts.set_false(i);
    }
    mapf[fir].push_back(i);
    auto ttp = mapall[fir];
    if (ttp.size() > 0) {
      for (int j = 0; j < ttp.size(); j++) {
        ts.add_nand(ttp[j], i);
        ts.add_nand(i, ttp[j]);
      }
    }
    auto tttp = mapall[sec];
    if (tttp.size() > 0) {
      for (int j = 0; j < tttp.size(); j++) {
        ts.add_nand(tttp[j], i + n);
        ts.add_nand(i + n, tttp[j]);
      }
    }
    mapall[fir].push_back(i);
    mapall[sec].push_back(i + n);
  }
  auto res = ts.build();
  if (res.empty())
    cout << "NO" << endl;
  else {
    for (int i = 0; i < n; i++) {
      if (res[i] == false && res[i + n] == false) {
        cout << "NO" << endl;
        return 0;
      }
    }
    cout << "YES" << endl;
    for (int i = 0; i < n; i++) {
      string ou = res[i] ? ans[i] : ans[i + n];
      cout << ou[0] << ou[1] << ou[2] << endl;
    }
  }
  return 0;
}
