#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b < a) {
    long long int temp = a;
    a = b;
    b = temp;
  }
  if (a == 0) {
    return b;
  }
  return gcd(b % a, a);
}
long long int lcm(long long int a, long long int b) {
  return (a * b / gcd(a, b));
}
long long int fact(long long int x) {
  long long int ans = 1;
  if (x == 0) {
    return 1;
  }
  while (x > 0) {
    ans = (ans * x) % 1000000007;
    x--;
  }
  return ans % 1000000007;
}
long long int power(long long int a, long long int b) {
  long long int ans = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      ans *= a;
      ans = ans;
    }
    b /= 2;
    a *= a;
    a = a;
  }
  return ans;
}
vector<long long int> getbinary(int x) {
  vector<long long int> bin(10, 0);
  long long int iter = 0;
  while (x > 0) {
    if (x % 2 == 1) {
      bin[iter] = 1;
    } else {
      bin[iter] = 0;
    }
    iter++;
    x /= 2;
  }
  return bin;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  string s1, s2;
  string a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> s1 >> s2;
    a[i] = s1.substr(0, 3);
    b[i] = s1.substr(0, 2) + s2[0];
  }
  map<string, int> insol;
  vector<int> ans(n, 0);
  string out[n];
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (a[i][0] == a[j][0] && a[i][1] == a[j][1] && a[i][2] == a[j][2]) {
        insol[a[i]] = 1;
        insol[b[i]] = 1;
        ans[i] = 2;
      }
    }
  }
  int flag = 1;
  while (flag) {
    flag = 0;
    for (int i = 0; i < n; i++) {
      if (ans[i]) {
        continue;
      }
      if (insol[a[i]]) {
        ans[i] = 1;
        insol[a[i]] = 1;
        insol[b[i]] = 1;
        flag = 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (ans[i]) {
      out[i] = b[i];
    } else {
      out[i] = a[i];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (out[i] == out[j]) {
        cout << "NO\n";
        return 0;
      }
    }
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) {
    cout << out[i] << endl;
  }
}
