func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   int a[210000][3];   set<pair<int, int> > st;   int nxt[210000][2];   int x[210000];   vector<pair<int, int> > re;   map<long long, int> mp;   int pp[210000];   long long hsh(int x, int y, int z) {     if (y > z) swap(y, z);     if (x > y) swap(x, y);     if (y > z) swap(y, z);     return ((long long)x << 40) + ((long long)y << 20) + z;   }   void init() {     cin >> n;     mp.clear();     st.clear();     re.clear();     for (int i = 0; i < n + 2; i++) nxt[i][0] = nxt[i][1] = 0;     pair<int, int> tmp;     for (int i = 0; i < n - 2; i++) {       scanf( %d%d%d , &a[i][0], &a[i][1], &a[i][2]);       mp[hsh(a[i][0], a[i][1], a[i][2])] = i + 1;       for (int j = 0; j < 3; j++) {         tmp = {a[i][j], a[i][(j + 1) % 3]};         if (tmp.first > tmp.second) swap(tmp.first, tmp.second);         if (st.count(tmp)) {           st.erase(tmp);           re.push_back(tmp);         } else           st.insert(tmp);       }     }     for (auto p : st) {       int x = p.first;       int y = p.second;       if (nxt[x][0])         nxt[x][1] = y;       else         nxt[x][0] = y;       if (nxt[y][0])         nxt[y][1] = x;       else         nxt[y][0] = x;     }     int pos = 1, lst = nxt[pos][0];     int cnt = 1;     while (1) {       printf( %d  , pos);       pp[pos] = cnt;       x[cnt++] = pos;       if (nxt[pos][0] == lst)         lst = pos, pos = nxt[pos][1];       else         lst = pos, pos = nxt[pos][0];       if (pos == 1) break;     }     cout << endl;     for (int i = 1; i <= n; i++) {       nxt[x[i]][0] = x[i - 1];       nxt[x[i]][1] = x[i + 1];     }     nxt[x[1]][0] = x[n];     nxt[x[n]][1] = x[1];   }   bool cmp(pair<int, int> p1, pair<int, int> p2) {     int x1 = pp[p1.second] - pp[p1.first];     int x2 = pp[p2.second] - pp[p2.first];     if (x1 < 0) x1 += n;     if (x2 < 0) x2 += n;     if (x1 > n / 2) x1 = n - x1;     if (x2 > n / 2) x2 = n - x2;     return x1 < x2;   }   bool visit[210000];   void work() {     for (int i = 1; i <= n - 2; i++) visit[i] = 1;     sort(re.begin(), re.end(), cmp);     int t;     for (auto p : re) {       int x = p.first;       int y = p.second;       int t;       if (nxt[x][0] == nxt[y][1]) {         t = nxt[x][0];         nxt[x][0] = y;         nxt[y][1] = x;       } else {         t = nxt[x][1];         nxt[x][1] = y;         nxt[y][0] = x;       }       int xx = mp[hsh(x, y, t)];       cout << xx <<    ;       visit[xx] = 0;     }     for (int i = 1; i <= n - 2; i++)       if (visit[i]) cout << i;     cout << endl;   }   int main() {     int t;     cin >> t;     while (t--) {       init();       work();     }     return ~~(0 ^ 0 ^ 0);   }   