#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const int M = 2e4;
int n;
int x[1005], y[1005];
vector<int> g[40000];
bool used[40000];
int num(string s) {
  int ans = 0;
  for (int i = 0; i < 3; ++i) {
    ans += pow(26, i) * (s[i] - 'A');
  }
  return ans;
}
string str(int x) {
  string ans;
  int T = 3;
  while (T--) {
    int ost = x % 26;
    ans.push_back('A' + ost);
    x /= 26;
  }
  return ans;
}
void del(int x) {
  used[x] = true;
  for (auto v : g[x]) {
    used[v] = true;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n;
  string s1, s2;
  vector<int> ans(n + 1, 0);
  for (int i = 1; i <= n; ++i) {
    cin >> s1 >> s2;
    string s1_, s2_;
    s1_ += s1[0], s1_ += s1[1];
    s2_ = s1_;
    s2_ += s2.front(), s1_ += s1[2];
    x[i] = num(s1_), y[i] = num(s2_);
    g[x[i]].push_back(M + y[i]), g[M + y[i]].push_back(x[i]);
    g[x[i]].push_back(M + x[i]), g[M + y[i]].push_back(y[i]);
  }
  if (n == 1) {
    cout << "YES" << endl;
    cout << str(x[1]) << endl;
    return 0;
  }
  int q1 = 0, q2 = 0;
  for (int i = 0; i < M; ++i) {
    if ((int)g[i].size() > 0) {
      ++q1;
    }
  }
  for (int i = M; i < 40000; ++i) {
    if ((int)g[i].size() > 0) {
      ++q2;
    }
  }
  if (max(q1, q2) < n) {
    cout << "NO" << endl;
    return 0;
  }
  if (q2 > q1) {
    for (int i = 1; i <= n; ++i) {
      ans[i] = y[i];
    }
  } else {
    for (int i = 1; i <= n; ++i) {
      ans[i] = x[i];
    }
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; ++i) {
    cout << str(ans[i]) << endl;
  }
  return 0;
}
