#include <bits/stdc++.h>
using namespace std;
const int N = 2500, E = 2500 * 2500;
int n;
int *head, *to, *nxt;
int headG[N], toG[E], nxtG[E];
int headC[N], toC[E], nxtC[E];
int low[N], idx[N], in[N], dfs;
int Stack[N], topIndex;
int compIdx[N], vis[N], vid, NComp;
int e, cnt;
int ord[N], res[N], rev[N];
string ans1[1000], ans2[1000];
void init() {
  e = 0;
  memset(head, -1, n * (sizeof head[0]));
  memset(in, 0, n * (sizeof in[0]));
}
void addEdge(int first, int t) {
  nxt[e] = head[first];
  head[first] = e;
  to[e++] = t;
}
void DFS(int u) {
  Stack[topIndex++] = u;
  vis[u] = vid;
  idx[u] = low[u] = dfs++;
  for (int i = head[u]; ~i; i = nxt[i]) {
    int v = to[i];
    if (vis[v] != vid) {
      DFS(v);
      low[u] = min(low[u], low[v]);
    } else if (compIdx[v] == -1) {
      low[u] = min(low[u], low[v]);
    }
  }
  if (low[u] == idx[u]) {
    int v;
    do {
      v = Stack[--topIndex];
      compIdx[v] = NComp;
    } while (v != u);
    NComp++;
  }
}
void SCC() {
  memset(compIdx, -1, n * (sizeof compIdx[0]));
  dfs = 0;
  NComp = 0;
  vid++;
  for (int i = 0; i < n; i++) {
    if (vis[i] != vid) {
      DFS(i);
    }
  }
}
int getidx(int i) { return i * 2; }
int Not(int i) { return i ^ 1; }
void addOr(int i, int j) {
  addEdge(Not(i), j);
  addEdge(Not(j), i);
}
void addXor(int i, int j) {
  addOr(i, j);
  addOr(Not(i), Not(j));
}
void topoSort() {
  queue<int> q;
  for (int i = 0; i < NComp; i++) {
    if (!in[i]) q.push(i);
  }
  cnt = 0;
  while (!q.empty()) {
    int u = q.front();
    ord[cnt++] = u;
    q.pop();
    for (int j = head[u]; ~j; j = nxt[j]) {
      int v = to[j];
      if (!--in[v]) q.push(v);
    }
  }
}
int main() {
  int m;
  cin >> m;
  n = 2 * m;
  head = headG;
  to = toG;
  nxt = nxtG;
  init();
  for (int i = 0; i < m; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    ans1[i] += s1[0];
    ans1[i] += s1[1];
    ans1[i] += s1[2];
    ans2[i] += s1[0];
    ans2[i] += s1[1];
    ans2[i] += s2[0];
    for (int j = 0; j < i; j++) {
      if (ans1[j] == ans1[i]) {
        addOr(Not(getidx(i)), Not(getidx(i)));
        addOr(Not(getidx(j)), Not(getidx(j)));
      }
      if (ans1[i] == ans2[j]) {
        if (ans2[i] != ans1[j])
          addOr(Not(getidx(i)), getidx(j));
        else
          addXor(Not(getidx(i)), getidx(j));
      }
      if (ans2[i] == ans1[j]) {
        if (ans1[i] != ans2[j]) addOr(getidx(i), Not(getidx(j)));
      }
      if (ans2[i] == ans2[j]) {
        if (ans1[i] == ans1[j])
          addXor(getidx(j), getidx(i));
        else
          addOr(getidx(j), getidx(i));
      }
    }
  }
  SCC();
  n = NComp;
  head = headC;
  to = toC;
  nxt = nxtC;
  init();
  bool bad = false;
  for (int i = 0; i < 2 * m; i += 2) {
    if (compIdx[i] == compIdx[Not(i)]) {
      bad = true;
      printf("NO\n");
      break;
    }
  }
  if (bad) return 0;
  cout << "YES" << endl;
  for (int u = 0; u < 2 * m; u++) {
    for (int j = headG[u]; ~j; j = nxtG[j]) {
      int v = toG[j];
      if (compIdx[u] != compIdx[v]) {
        addEdge(compIdx[u], compIdx[v]);
        in[compIdx[v]]++;
      }
    }
  }
  topoSort();
  for (int i = 0; i < 2 * m; i++) {
    rev[compIdx[i]] = compIdx[Not(i)];
  }
  vid++;
  for (int i = 0; i < NComp; i++) {
    int cur = ord[i];
    if (vis[cur] == vid) continue;
    res[cur] = 0;
    res[rev[cur]] = 1;
    vis[rev[cur]] = vid;
  }
  for (int i = 0; i < 2 * m; i += 2) {
    if (res[compIdx[i]])
      cout << ans1[i / 2];
    else
      cout << ans2[i / 2];
    cout << endl;
  }
  return 0;
}
