func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2005, M = N * N;   bool vis[N];   char s[N][2][25];   int n, m, dfn[N], low[N], tt, S[N], col[N];   int hd[N], V[M], nx[M], fs[N], q[N], id[N], in[N];   vector<int> e[N];   void add(int u, int v) {     nx[++tt] = hd[u];     V[hd[u] = tt] = v;   }   void tarjan(int x) {     dfn[x] = low[x] = ++tt;     S[++S[0]] = x;     vis[x] = 1;     for (int i = hd[x]; i; i = nx[i]) {       if (!dfn[V[i]])         tarjan(V[i]), low[x] = min(low[x], low[V[i]]);       else if (vis[V[i]])         low[x] = min(low[x], dfn[V[i]]);     }     if (dfn[x] == low[x]) {       col[x] = ++col[0];       while (S[S[0]] != x) vis[S[S[0]]] = 0, col[S[S[0]--]] = col[0];       S[0]--;       vis[x] = 0;     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %s%s , s[i][0], s[i][1]);     for (int i = 1; i <= n; i++)       for (int j = i + 1; j <= n; j++) {         bool J = 1;         for (int k = 0; k < 3; k++) J &= (s[i][0][k] == s[j][0][k]);         if (J) add(i, i + n), add(j, j + n);         J = (s[i][1][0] == s[j][1][0]);         for (int k = 0; k < 2; k++) J &= (s[i][0][k] == s[j][0][k]);         if (J) add(i + n, j), add(j + n, i);         J = (s[i][0][2] == s[j][1][0]);         for (int k = 0; k < 2; k++) J &= (s[i][0][k] == s[j][0][k]);         if (J) add(i, j), add(j + n, i + n);         J = (s[i][1][0] == s[j][0][2]);         for (int k = 0; k < 2; k++) J &= (s[i][0][k] == s[j][0][k]);         if (J) add(j, i), add(i + n, j + n);       }     tt = 0;     for (int i = 1; i <= n + n; i++)       if (!dfn[i]) tarjan(i);     for (int i = 1; i <= n; i++)       if (col[i] == col[i + n]) {         puts( NO );         return 0;       }     puts( YES );     for (int i = 1; i <= n + n; i++)       for (int j = hd[i]; j; j = nx[j])         if (col[V[j]] != col[i]) e[col[i]].push_back(col[V[j]]), in[col[V[j]]]++;     int l = 1, r = 0;     for (int i = 1; i <= col[0]; i++)       if (!in[i]) q[id[i] = ++r] = i;     while (l <= r) {       int x = q[l++], z = e[x].size();       for (int v, i = 0; i < z; i++)         if (!(--in[v = e[x][i]])) q[id[v] = ++r] = v;     }     for (int i = 1; i <= n; i++) {       if (id[col[i]] < id[col[i + n]]) s[i][0][2] = s[i][1][0];       for (int k = 0; k < 3; k++) putchar(s[i][0][k]);       puts(  );     }     return 0;   }   