#include <bits/stdc++.h>
using namespace std;
const int N = 4009, M = 1e5;
int head[N], nxt[M], to[M], ne, n, m;
vector<string> arr[N];
map<string, vector<int> > m1;
map<string, vector<int> > m2;
void init() {
  m1.clear();
  m2.clear();
  ne = 0;
  memset(head, -1, sizeof(head));
}
void addEdge(int x, int y) {
  nxt[ne] = head[x];
  head[x] = ne;
  to[ne] = y;
  ne++;
}
int compID[N], dfsTime[N], lowTime[N], nodeID, cmpID, stk[N], stkID;
void dfsSCC(int src) {
  lowTime[src] = dfsTime[src] = nodeID++;
  stk[stkID++] = src;
  for (int k = head[src]; k != -1; k = nxt[k]) {
    int j = to[k];
    if (dfsTime[j] == -1) {
      dfsSCC(j);
      lowTime[src] = min(lowTime[src], lowTime[j]);
    } else if (compID[j] == -1)
      lowTime[src] = min(lowTime[src], lowTime[j]);
  }
  if (lowTime[src] == dfsTime[src]) {
    do {
      compID[stk[--stkID]] = cmpID;
    } while (stk[stkID] != src);
    cmpID++;
  }
}
void scc() {
  nodeID = 0;
  cmpID = 0;
  stkID = 0;
  memset(dfsTime, -1, sizeof(dfsTime));
  memset(compID, -1, sizeof(compID));
  for (int i = 0; i < n * 4; i++) {
    if (dfsTime[i] == -1) {
      dfsSCC(i);
    }
  }
}
void addOr(int x, int y) {
  addEdge((x ^ 1), y);
  addEdge((y ^ 1), x);
}
void addImplication(int x, int y) {
  addEdge(x, y);
  addEdge((y ^ 1), (x ^ 1));
}
void addXor(int x, int y) {
  addEdge(x, (y ^ 1));
  addEdge(y, (x ^ 1));
  addEdge((x ^ 1), y);
  addEdge((y ^ 1), x);
}
bool vis[N];
int res[N];
void dfsSol(int src) {
  vis[src] = 1;
  for (int k = head[src]; k != -1; k = nxt[k])
    if (!vis[to[k]]) dfsSol(to[k]);
  if (res[compID[src]] == -1) {
    res[compID[src]] = 1;
    res[compID[(src ^ 1)]] = 0;
  }
}
bool getSol() {
  for (int i = 0; i < n * 2; i++) {
    if (compID[(i * 2)] == compID[((i * 2) | 1)]) {
      return 0;
    }
  }
  memset(vis, 0, sizeof(vis));
  memset(res, -1, sizeof(res));
  for (int i = 0; i < n * 4; i++) {
    if (!vis[i]) dfsSol(i);
  }
  return 1;
}
int main() {
  string str1, str2, str3, str4;
  scanf("%d", &n);
  init();
  char c1, c2, c3, c4;
  for (int i = 0; i < n; i++) {
    str3 = "";
    str4 = "";
    cin >> str1 >> str2;
    c1 = str1[0];
    c2 = str1[1];
    c3 = str1[2];
    c4 = str2[0];
    str3 += c1;
    str3 += c2;
    str3 += c3;
    str4 += c1;
    str4 += c2;
    str4 += c4;
    arr[i].push_back(str3);
    arr[i].push_back(str4);
    addXor(((i * 2) * 2), (((i * 2) | 1) * 2));
    if (m1[str3].size() != 0) {
      addOr((((i * 2) | 1) * 2), (((i * 2) | 1) * 2));
      if (m1[str3].size() == 1) {
        int x = m1[str3][0] - 1;
        addOr((((x * 2) | 1) * 2), (((x * 2) | 1) * 2));
      }
    }
    if (m2[str3].size() != 0) {
      for (int j = 0; j < m2[str3].size(); j++) {
        int x = m2[str3][j] - 1;
        addImplication(((i * 2) * 2), ((((x * 2) | 1) * 2) | 1));
      }
    }
    if (m1[str4].size() != 0) {
      for (int j = 0; j < m1[str4].size(); j++) {
        int x = m1[str4][j] - 1;
        addImplication((((i * 2) | 1) * 2), (((x * 2) * 2) | 1));
      }
    }
    if (m2[str4].size() != 0) {
      addOr(((i * 2) * 2), ((i * 2) * 2));
      if (m2[str4].size() == 1) {
        int x = m2[str4][0] - 1;
        addOr(((x * 2) * 2), ((x * 2) * 2));
      }
    }
    m1[str3].push_back(i + 1);
    m2[str4].push_back(i + 1);
  }
  scc();
  if (getSol()) {
    printf("YES\n");
    for (int i = 0; i < n; i++) {
      if (res[compID[((i * 2) * 2)]])
        cout << arr[i][0] << endl;
      else
        cout << arr[i][1] << endl;
    }
  } else
    printf("NO\n");
  return 0;
}
