func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   int t, n, inp[3], cnt[100010];   map<pair<int, int>, vector<pair<int, int>>> el;   int root;   vector<int> qans;   vector<int> neigh[100010];   void solve() {     cin >> n;     el.clear();     for (int i = 1; i <= n; ++i) cnt[i] = 0, neigh[i].clear();     for (int i = 1; i + 2 <= n; ++i) {       for (int j = 0; j < 3; ++j) {         cin >> inp[j];         ++cnt[inp[j]];       }       sort(inp, inp + 3);       if (el.count({inp[0], inp[1]}))         el[{inp[0], inp[1]}].push_back({inp[2], i});       else         el[{inp[0], inp[1]}] = {{inp[2], i}};       if (el.count({inp[0], inp[2]}))         el[{inp[0], inp[2]}].push_back({inp[1], i});       else         el[{inp[0], inp[2]}] = {{inp[1], i}};       if (el.count({inp[1], inp[2]}))         el[{inp[1], inp[2]}].push_back({inp[0], i});       else         el[{inp[1], inp[2]}] = {{inp[0], i}};     }     for (auto& x : el) {       if (x.second.size() == 1) {         neigh[x.first.first].push_back(x.first.second);         neigh[x.first.second].push_back(x.first.first);       }     }     cout << 1 <<     << neigh[1][0];     int curr = neigh[1][0], prev = 1;     for (int i = 3; i <= n; ++i) {       if (neigh[curr][0] == prev) {         cout <<     << neigh[curr][1];         prev = curr;         curr = neigh[curr][1];       } else {         cout <<     << neigh[curr][0];         prev = curr;         curr = neigh[curr][0];       }     }     cout << endl;     for (int i = 1; i <= n; ++i)       if (cnt[i] == 1) {         root = i;         break;       }     pair<int, int> ce = {neigh[root][0], neigh[root][1]};     if (ce.first > ce.second) swap(ce.first, ce.second);     for (auto& x : el[ce]) {       if (x.first == root) {         qans.push_back(x.second);       }     }     queue<pair<pair<int, int>, int>> qq;     qq.push({ce, root});     while (!qq.empty()) {       auto x = qq.front();       qq.pop();       if (el[x.first].size() == 1) {         continue;       }       pair<int, int> y =           (el[x.first][0].first == x.second ? el[x.first][1] : el[x.first][0]);       qans.push_back(y.second);       pair<int, int> nxt1 = {x.first.first, y.first},                      nxt2 = {x.first.second, y.first};       if (nxt1.first > nxt1.second) swap(nxt1.first, nxt1.second);       if (nxt2.first > nxt2.second) swap(nxt2.first, nxt2.second);       qq.push({nxt1, x.first.second});       qq.push({nxt2, x.first.first});     }     while (!qans.empty()) {       cout << qans.back() <<    ;       qans.pop_back();     }     cout << endl;   }   int main() {     ios::sync_with_stdio(false);     for (cin >> t; t--;) solve();     return 0;   }   