#include <bits/stdc++.h>
using namespace std;
string first(string &s) {
  string sol = "";
  sol = sol + s[0] + s[1] + s[2];
  return sol;
}
string second(string &s) {
  string sol = "";
  sol = sol + s[0] + s[1] + s[3];
  return sol;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<string> arr, sol(n);
  for (int i = 0; i < n; ++i) {
    string fn, sn;
    cin >> fn >> sn;
    string add = "";
    add = add + fn[0] + fn[1] + fn[2] + sn[0];
    arr.push_back(add);
  }
  set<string> occupied;
  bitset<1005> check;
  for (int i = 0; i < n; ++i) {
    if (!check[i]) {
      bool hasmore = false;
      for (int j = i + 1; j < n; ++j) {
        if (first(arr[i]) == first(arr[j])) {
          hasmore = true;
          break;
        }
      }
      if (hasmore) {
        for (int j = i; j < n; ++j) {
          if (first(arr[i]) == first(arr[j])) {
            if (occupied.count(second(arr[j]))) {
              cout << "NO";
              return 0;
            }
            occupied.insert(second(arr[j]));
            sol[j] = second(arr[j]);
            check[j] = true;
          }
        }
      }
    }
  }
  for (int j = 1; j <= n; ++j) {
    for (int i = 0; i < n; ++i) {
      if (!check[i]) {
        if (occupied.count(first(arr[i]))) {
          if (occupied.count(second(arr[i]))) {
            cout << "NO";
            return 0;
          }
          sol[i] = second(arr[i]);
          occupied.insert(second(arr[i]));
          check[i] = true;
        } else {
          if (occupied.count(second(arr[i]))) {
            sol[i] = first(arr[i]);
            occupied.insert(first(arr[i]));
            check[i] = true;
          }
        }
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    if (!check[i]) {
      sol[i] = first(arr[i]);
    }
  }
  cout << "YES\n";
  for (auto it : sol) {
    cout << it << "\n";
  }
  return 0;
}
