#include <bits/stdc++.h>
using namespace std;
void solve();
long long debug = 0;
int main() {
  if (debug) {
    freopen("input", "r", stdin);
    freopen("output", "w", stdout);
  }
  solve();
}
void gg() {
  cout << "NO";
  exit(0);
}
long long cnt[26][26][26];
struct Gm {
  char a, b;
  long long ind;
  bool used;
  Gm(char c, long long i) {
    a = c;
    b = '-';
    ind = i;
    used = 0;
  }
  Gm(char c, char v, long long i) {
    a = c;
    b = v;
    ind = i;
    used = 0;
  }
  long long getF() { return a - 'A'; }
  long long getS() {
    if (b == '-')
      return -1;
    else
      return b - 'A';
  }
};
void solve() {
  long long n;
  cin >> n;
  vector<pair<string, string> > v(n);
  set<pair<long long, pair<char, char> > > unic;
  for (long long i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
    cnt[v[i].first[0] - 'A'][v[i].first[1] - 'A'][v[i].first[2] - 'A']++;
  }
  vector<Gm> sm[26][26];
  for (long long i = 0; i < n; i++) {
    if (cnt[v[i].first[0] - 'A'][v[i].first[1] - 'A'][v[i].first[2] - 'A'] >
            1 ||
        v[i].second[0] == v[i].first[2]) {
      sm[v[i].first[0] - 'A'][v[i].first[1] - 'A'].push_back(
          Gm(v[i].second[0], i));
    } else {
      sm[v[i].first[0] - 'A'][v[i].first[1] - 'A'].push_back(
          Gm(v[i].second[0], v[i].first[2], i));
    }
  }
  vector<long long> ans(n);
  for (long long i = 0; i < 26; i++) {
    for (long long j = 0; j < 26; j++) {
      if (sm[i][j].size() == 0) continue;
      long long size = sm[i][j].size();
      if (size > 26) gg();
      vector<long long> kek(26);
      for (long long k = 0; k < sm[i][j].size(); k++) {
        kek[sm[i][j][k].getF()]++;
        if (sm[i][j][k].getS() != -1) kek[sm[i][j][k].getS()]++;
      }
      set<long long> nums;
      while (size) {
        long long mn = 1000000;
        long long num = 0;
        for (long long k = 0; k < kek.size(); k++) {
          if (kek[k] != 0 && kek[k] < mn) {
            mn = kek[k];
            num = k;
          }
        }
        if (nums.count(num))
          gg();
        else
          nums.insert(num);
        for (long long k = 0; k < sm[i][j].size(); k++) {
          if (sm[i][j][k].used) continue;
          if (sm[i][j][k].getF() == num) {
            ans[sm[i][j][k].ind] = num;
            kek[num]--;
            if (sm[i][j][k].getS() != -1) kek[sm[i][j][k].getS()]--;
            size--;
            sm[i][j][k].used = 1;
            break;
          } else if (sm[i][j][k].getS() != -1 && sm[i][j][k].getS() == num) {
            ans[sm[i][j][k].ind] = num;
            kek[num]--;
            kek[sm[i][j][k].getF()]--;
            size--;
            sm[i][j][k].used = 1;
            break;
          }
        }
      }
    }
  }
  cout << "YES\n";
  for (long long i = 0; i < n; i++) {
    cout << v[i].first[0] << v[i].first[1] << char(ans[i] + 'A') << endl;
  }
}
