func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   vector<string> cards;   map<vector<string>, bool> used;   void rec(vector<string>& x) {     if (x.size() == 1) {       puts( YES );       exit(0);     }     if (used[x] == true) return;     used[x] = true;     int p = x.size() - 1;     if (x[p][0] == x[p - 1][0] || x[p][1] == x[p - 1][1]) {       string s = x[p - 1];       string c = x[p];       x[p - 1] = x[p];       x.pop_back();       rec(x);       x[p - 1] = s;       x.push_back(c);     }     if (p > 2 && (x[p][0] == x[p - 3][0] || x[p][1] == x[p - 3][1])) {       string s = x[p - 3];       string c = x[p];       x[p - 3] = x[p];       x.pop_back();       rec(x);       x[p - 3] = s;       x.push_back(c);     }   }   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       string s;       cin >> s;       cards.push_back(s);     }     rec(cards);     puts( NO );     return 0;   }   