#include <bits/stdc++.h>
using namespace std;
const int N = 800005;
int head[N], nxt[N << 3], to[N << 3], from[N << 3], no = 0;
void link(int a, int b) {
  nxt[no] = head[a];
  from[no] = a;
  to[no] = b;
  head[a] = no++;
}
void addor(int a, int b) {
  link(a ^ 1, b);
  link(b ^ 1, a);
}
void addandor(int a, int b, int c, int d) {
  addor(a, c);
  addor(a, d);
  addor(b, c);
  addor(b, d);
}
void addxnor(int a, int b) {
  link(a, b);
  link(b, a);
  link(a ^ 1, b ^ 1);
  link(b ^ 1, a ^ 1);
}
void must0(int a) { link(a, a ^ 1); }
void must1(int a) { link(a ^ 1, a); }
int dfsnum[N], low[N], ccnum[N], cnum = 0, dfsn = 0, chead[N];
bool instack[N];
stack<int> scc;
void dfs(int idx) {
  dfsnum[idx] = low[idx] = dfsn++;
  scc.push(idx);
  instack[idx] = 1;
  for (int i = head[idx]; ~i; i = nxt[i]) {
    int nx = to[i];
    if (dfsnum[nx] == -1) dfs(nx);
    if (instack[nx]) low[idx] = min(low[idx], low[nx]);
  }
  if (dfsnum[idx] == low[idx]) {
    while (scc.top() != idx) {
      int v = scc.top();
      scc.pop();
      ccnum[v] = cnum;
      instack[v] = 0;
    }
    scc.pop();
    chead[cnum] = idx;
    ccnum[idx] = cnum;
    chead[cnum] = idx;
    instack[idx] = 0;
    cnum++;
  }
}
bool vis[N];
int cval[N];
bool src[N];
vector<vector<int>> adj;
void topo(int idx) {
  if (vis[idx]) return;
  vis[idx] = 1;
  for (auto x : adj[idx]) {
    topo(x);
  }
  if (cval[idx] == -1) {
    cval[idx] = 1;
    cval[ccnum[chead[idx] ^ 1]] = 0;
  }
}
int main() {
  memset(head, -1, sizeof head);
  int n;
  cin >> n;
  vector<pair<string, string>> arr(n);
  for (int i = 0; i < n; i++) {
    string x, y, a = "", b = "";
    cin >> x >> y;
    b += x[0];
    b += x[1];
    b += y[0];
    a += x[0];
    a += x[1];
    a += x[2];
    arr[i].first = a;
    arr[i].second = b;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) continue;
      if (arr[i].first == arr[j].first) {
        addxnor(i << 1, j << 1);
        link((i << 1) ^ 1, (i << 1));
        link((j << 1) ^ 1, (j << 1));
      }
      if (arr[i].first == arr[j].second) addxnor(i << 1, j << 1);
      if (arr[i].second == arr[j].first) addxnor(i << 1, j << 1);
      if (arr[i].second == arr[j].second) {
        link((i << 1), (j << 1) ^ 1);
        link((j << 1), (i << 1) ^ 1);
      }
    }
  }
  memset(dfsnum, -1, sizeof dfsnum);
  n <<= 1;
  for (int i = 0; i < n; i++) {
    if (dfsnum[i] == -1) dfs(i);
  }
  for (int i = 0; i < n; i += 2) {
    if (ccnum[i] == ccnum[i ^ 1]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES\n";
  adj.resize(cnum);
  memset(cval, -1, sizeof cval);
  for (int i = 0; i < no; ++i) {
    int a = from[i], b = to[i];
    if (ccnum[a] != ccnum[b]) {
      src[ccnum[b]] = 1;
      adj[ccnum[a]].push_back(ccnum[b]);
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (!src[ccnum[i]]) topo(ccnum[i]);
  }
  for (int i = 0; i < n; i += 2) {
    int id = cval[ccnum[i]];
    if (id)
      cout << arr[i >> 1].second << "\n";
    else
      cout << arr[i >> 1].first << "\n";
  }
}
