#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const long long INF = (long long)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;
int n, bad[3030], u[3030], pr[3030];
string names[3030], the_name[3030];
pair<pair<int, int>, int> edge[3030];
map<string, int> m;
map<string, int>::iterator it;
vector<int> v[3030];
vector<int> teams, names_ver;
int get_ver(int e, int from) {
  if (edge[e].first.first == from) return edge[e].first.second;
  return edge[e].first.first;
}
int get_edge_type(int e) { return edge[e].second; }
bool dfs(int ver, int ver_type = 0) {
  if (u[ver]) return 0;
  u[ver] = 1;
  for (int i = 0; i < (int)v[ver].size(); ++i) {
    int e = v[ver][i], to = get_ver(e, ver), edge_type = get_edge_type(e);
    if (bad[e]) continue;
    if (pr[to] == -1 || dfs(pr[to])) {
      pr[to] = ver;
      return 1;
    }
  }
  return 0;
}
int main() {
  cin >> n;
  int cur_ver = 0, cur_edge = 0;
  for (int i = 0; i < n; ++i) {
    char team[100], home[100];
    cin >> team >> home;
    int cur_team = cur_ver, cur_name1, cur_name2;
    teams.push_back(cur_team);
    string first_name = "", second_name = "";
    first_name += team[0], first_name += team[1], first_name += team[2];
    second_name += team[0], second_name += team[1], second_name += home[0];
    if (m.find(first_name) != m.end()) {
      cur_name1 = m[first_name];
    } else {
      cur_ver++;
      m[first_name] = cur_ver;
      cur_name1 = cur_ver;
      the_name[cur_name1] = first_name;
      names_ver.push_back(cur_name1);
    }
    if (m.find(second_name) != m.end()) {
      cur_name2 = m[second_name];
    } else {
      cur_ver++;
      m[second_name] = cur_ver;
      cur_name2 = cur_ver;
      the_name[cur_name2] = second_name;
      names_ver.push_back(cur_name2);
    }
    v[cur_team].push_back(cur_edge);
    v[cur_name1].push_back(cur_edge);
    edge[cur_edge++] = make_pair(make_pair(cur_team, cur_name1), 1);
    v[cur_team].push_back(cur_edge);
    v[cur_name2].push_back(cur_edge);
    edge[cur_edge++] = make_pair(make_pair(cur_team, cur_name2), 2);
    cur_ver++;
  }
  for (int i = 0; i < (int)names_ver.size(); ++i) {
    int from = names_ver[i];
    int cnt1 = 0;
    for (int j = 0; j < (int)v[from].size(); ++j) {
      int e = v[from][j], edge_type = get_edge_type(e);
      if (edge_type == 1) cnt1++;
    }
    if (cnt1 > 1) {
      for (int j = 0; j < (int)v[from].size(); ++j) {
        int e = v[from][j], edge_type = get_edge_type(e);
        if (edge_type == 1) bad[e] = 1;
      }
    }
  }
  for (int i = 0; i < 3030; ++i) {
    names[i] = "#";
    pr[i] = -1;
  }
  for (int i = 0; i < cur_ver; ++i) {
    for (int j = 0; j < 3030; ++j) {
      u[j] = 0;
    }
    dfs(i);
  }
  for (int i = 0; i < (int)teams.size(); ++i) {
    int cur = teams[i];
    if (pr[cur] == -1) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
  for (int i = 0; i < (int)teams.size(); ++i) {
    int cur = teams[i];
    cout << the_name[pr[cur]] << "\n";
  }
  return 0;
}
