func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   void out(T x) {     cout << x << endl;     exit(0);   }   const int maxn = 1e6 + 5;   vector<int> get(map<int, vector<int>> mp) {     vector<int> res;     for (auto p : mp) {       for (auto x : p.second) {         res.push_back(x);       }     }     return res;   }   int n;   map<int, vector<int>> mp;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 0; i < n; i++) {       int x;       cin >> x;       mp[x].push_back(i + 1);     }     vector<vector<int>> ans;     bool ok = false;     int val = -1;     vector<int> v;     for (auto p : mp) {       v.push_back(p.first);       if (int(p.second.size()) >= 3) {         val = p.first;         ok = true;         break;       }     }     map<int, vector<int>> _mp = mp;     if (ok) {       int x = val;       swap(mp[x][0], mp[x][1]);       ans.push_back(get(mp));       mp = _mp;       swap(mp[x][0], mp[x][2]);       ans.push_back(get(mp));       mp = _mp;       swap(mp[x][1], mp[x][2]);       ans.push_back(get(mp));       mp = _mp;     } else {       int N = v.size();       int val1, val2;       for (int i = 0; i < N; i++) {         for (int j = i + 1; j < N; j++) {           if (int(mp[v[i]].size()) >= 2 && int(mp[v[j]].size()) >= 2) {             val1 = v[i];             val2 = v[j];             ok = true;           }         }       }       if (!ok) out( NO );       ans.push_back(get(mp));       mp = _mp;       swap(mp[val1][0], mp[val1][1]);       ans.push_back(get(mp));       mp = _mp;       swap(mp[val2][0], mp[val2][1]);       ans.push_back(get(mp));       mp = _mp;     }     cout <<  YES  << endl;     for (auto p : ans) {       for (auto x : p) cout << x <<    ;       cout << endl;     }     return 0;   }   