#include <bits/stdc++.h>
using namespace std;
typedef struct graph {
  graph(int a) {
    n = 2 * a;
    adj.resize(n);
    seen.resize(n);
    fill(seen.begin(), seen.end(), 0);
    radj.resize(n);
    scc.resize(n);
    assignment.resize(n);
    fill(assignment.begin(), assignment.end(), -1);
    order.resize(n);
    ft.resize(n);
  }

 private:
  vector<vector<int>> adj, radj;
  vector<int> seen, scc, assignment, order, ft;
  int n, timera, timerb;
  void _rdfs(int u, int sccId);
  void _addE(int u, int v);

 public:
  void addC(int p, int q);
  void dfs(int u);
  void findSCC();
  int parent(int u);
  pair<bool, bool> assign(int id, bool value);
  void remove(int p);
  int getValue(int p);
  bool isSat();
  int component(int u);
  int byFinishedTime(int ft);
  void prepareDfs();
} Graph;
void graph::_addE(int a, int b) {
  adj[a].emplace_back(b);
  radj[b].emplace_back(a);
}
void graph::addC(int p, int q) {
  _addE(((p ^ 1)), q);
  _addE(((q ^ 1)), p);
}
void graph::prepareDfs() {
  timera++;
  timerb = 0;
}
void graph::dfs(int u) {
  if (seen[u] == timera) return;
  seen[u] = timera;
  for (const auto &v : adj[u]) {
    dfs(v);
  }
  ft[u] = timerb++;
}
int graph::byFinishedTime(int ft) { return order[ft]; }
void graph::_rdfs(int u, int sccId) {
  if (seen[u] == timera) return;
  seen[u] = timera;
  scc[u] = sccId;
  for (const auto &v : radj[u]) {
    _rdfs(v, sccId);
  }
}
pair<bool, bool> graph::assign(int id, bool value) {
  if (~assignment[scc[id]]) {
    return {assignment[scc[id]] == value, 0};
  } else {
    assignment[scc[id]] = value;
    assignment[scc[((id ^ 1))]] = !value;
    return {true, true};
  }
}
int graph::getValue(int id) { return assignment[scc[id]]; }
bool graph::isSat() {
  bool sat = 1;
  for (int i = n - 1; i >= 0; i--) {
    int u = order[i];
    if (scc[u] == scc[((u ^ 1))]) sat &= 0;
    auto res = assign(u, 1);
  }
  return sat;
}
void graph::findSCC() {
  prepareDfs();
  for (int i = 0; i < n; i++) {
    dfs(i);
    order[ft[i]] = i;
  }
  prepareDfs();
  int sccId = 0;
  for (int i = n - 1; i >= 0; i--) {
    int u = order[i];
    if (seen[u] < timera) {
      _rdfs(u, sccId++);
    }
  }
}
int graph::component(int u) { return scc[u]; }
const int mx = 1123;
string a[mx], b[mx];
int main() {
  int n;
  cin >> n;
  Graph g(2 * n);
  for (int i = 0; i < n; i++) {
    string f, s;
    cin >> f >> s;
    a[i] = f.substr(0, 3);
    b[i] = f.substr(0, 2) + s.substr(0, 1);
  }
  for (int i = 0; i < n; i++) {
    g.addC(((i << 2) + (0 << 1)), ((i << 2) + (1 << 1)));
    for (int j = 0; j < n; j++) {
      if (i == j) continue;
      if (a[i] == a[j]) {
        g.addC(((((i << 2) + (0 << 1)) ^ 1)), ((((j << 2) + (0 << 1)) ^ 1)));
      }
      if (a[i] == b[j]) {
        g.addC(((((i << 2) + (0 << 1)) ^ 1)), ((((j << 2) + (1 << 1)) ^ 1)));
      }
      if (b[i] == a[j]) {
        g.addC(((((i << 2) + (1 << 1)) ^ 1)), ((((j << 2) + (0 << 1)) ^ 1)));
      }
      if (b[i] == b[j]) {
        g.addC(((((i << 2) + (1 << 1)) ^ 1)), ((((j << 2) + (1 << 1)) ^ 1)));
      }
      if (a[i] == a[j]) {
        g.addC(((((i << 2) + (1 << 1)) ^ 1)), ((((j << 2) + (0 << 1)) ^ 1)));
      }
    }
  }
  g.findSCC();
  if (!g.isSat()) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) {
    if (!g.getValue(((i << 2) + (0 << 1)))) {
      cout << a[i] << endl;
    } else {
      cout << b[i] << endl;
    }
  }
}
