func_code_string: #include <bits/stdc++.h>   using namespace std;   double const pi = 3.1415926535897932384626433832795;   int const inf = (int)1e9;   long long const inf64 = (long long)2e18;   const string name =  d ;   vector<pair<int, int> > ans;   int n, d[21];   void rec(int n, int x, int y, int z, bool rev) {     if (n == 0) return;     int now = n - 1;     while (now >= 0 && d[now] == d[n - 1]) now--;     if (now == -1) {       if (rev)         for (int i = 0; i < (int)n; i++) ans.push_back(make_pair(x, y));       else {         for (int i = 0; i < (int)n - 1; i++) ans.push_back(make_pair(x, z));         ans.push_back(make_pair(x, y));         for (int i = 0; i < (int)n - 1; i++) ans.push_back(make_pair(z, y));       }       return;     }     if (now + 1 == n - 1) {       rec(now + 1, x, z, y, 1);       ans.push_back(make_pair(x, y));       rec(now + 1, z, y, x, 1);     } else {       if (!rev) {         rec(now + 1, x, y, z, 1);         for (int it = 0; it < (int)n - now - 1; it++)           ans.push_back(make_pair(x, z));         rec(now + 1, y, x, z, 1);         for (int it = 0; it < (int)n - now - 1; it++)           ans.push_back(make_pair(z, y));         rec(now + 1, x, y, z, 0);       } else {         rec(now + 1, x, z, y, 1);         for (int it = 0; it < (int)n - now - 1; it++)           ans.push_back(make_pair(x, y));         rec(now + 1, z, y, x, 1);       }     }   }   int main() {     cin >> n;     for (int i = 0; i < (int)n; i++) cin >> d[i];     reverse(d, d + n);     rec(n, 0, 2, 1, 0);     cout << ans.size() << endl;     for (int i = 0; i < (int)ans.size(); i++)       printf( %d %d n , ans[i].first + 1, ans[i].second + 1);     return 0;   }   