#include <bits/stdc++.h>
using namespace std;
int n, m, num = 0;
vector<vector<int>> G, RevG, Comp, W;
vector<int> Used, Topsort, Where, Order;
void dfs(int v) {
  Used[v] = 1;
  for (auto u : G[v]) {
    if (!Used[u]) {
      dfs(u);
    }
  }
  Topsort.push_back(v);
  return;
}
void revdfs(int v) {
  Used[v] = 1;
  Comp[num].push_back(v);
  Where[v] = num;
  for (auto u : RevG[v]) {
    if (!Used[u]) {
      revdfs(u);
    }
  }
  return;
}
void compdfs(int v) {
  Used[v] = 1;
  for (auto u : W[v]) {
    if (!Used[u]) {
      compdfs(u);
    }
  }
  for (auto q : Comp[v]) {
    Order.push_back(q);
  }
  return;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n;
  m = 2 * n;
  vector<vector<string>> Name(n, vector<string>(2));
  for (int i = 0; i < n; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    Name[i][0] = s1.substr(0, 3);
    Name[i][1] = s1.substr(0, 2);
    Name[i][1] += s2[0];
  }
  G.resize(m, vector<int>(0));
  RevG.resize(m, vector<int>(0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) {
        continue;
      }
      bool ff, fs, sf, ss;
      if (Name[i][0] == Name[j][0]) {
        ff = 1;
      } else {
        ff = 0;
      }
      if (Name[i][0] == Name[j][1]) {
        fs = 1;
      } else {
        fs = 0;
      }
      if (Name[i][1] == Name[j][0] || Name[i][0] == Name[j][0]) {
        sf = 1;
      } else {
        sf = 0;
      }
      if (Name[i][1] == Name[j][1]) {
        ss = 1;
      } else {
        ss = 0;
      }
      if ((ff && fs) && (sf && ss)) {
        cout << "NO";
        return 0;
      }
      if (ff) {
        G[2 * i].push_back(2 * j + 1);
        RevG[2 * j + 1].push_back(2 * i);
      }
      if (fs) {
        G[2 * i].push_back(2 * j);
        RevG[2 * j].push_back(2 * i);
      }
      if (sf) {
        G[2 * i + 1].push_back(2 * j + 1);
        RevG[2 * j + 1].push_back(2 * i + 1);
      }
      if (ss) {
        G[2 * i + 1].push_back(2 * j);
        RevG[2 * j].push_back(2 * i + 1);
      }
    }
  }
  Used.resize(m, 0);
  for (int i = 0; i < m; i++) {
    if (!Used[i]) {
      dfs(i);
    }
  }
  reverse(Topsort.begin(), Topsort.end());
  Where.resize(m, -1);
  fill(Used.begin(), Used.end(), 0);
  for (int i = 0; i < m; i++) {
    int now = Topsort[i];
    if (!Used[now]) {
      Comp.push_back(vector<int>(0));
      revdfs(now);
      num++;
    }
  }
  for (int i = 0; i < n; i++) {
    if (Where[2 * i] == Where[2 * i + 1]) {
      cout << "NO";
      return 0;
    }
  }
  W.resize(num, vector<int>(0));
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < (long long)(G[i]).size(); j++) {
      int v = Where[i];
      int u = Where[G[i][j]];
      W[v].push_back(u);
    }
  }
  Used.assign(num, 0);
  for (int i = 0; i < num; i++) {
    if (!Used[i]) {
      compdfs(i);
    }
  }
  reverse(Order.begin(), Order.end());
  vector<int> Ans(n, 0);
  for (int i = 0; i < m; i++) {
    Ans[Order[i] / 2] = Order[i] % 2;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) {
        continue;
      }
      if (Name[i][Ans[i]] == Name[j][Ans[j]]) {
        cout << "NO";
        return 0;
      }
      if (Ans[i] == 1 && Ans[j] == 0 && Name[i][Ans[0]] == Name[j][Ans[j]]) {
        cout << "NO";
        return 0;
      }
    }
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) {
    cout << Name[i][Ans[i]] << "\n";
  }
}
