#include <bits/stdc++.h>   using namespace std;   int n, cnt[100015], x[100015], y[100015], z[100015];   vector<int> a[100015];   int getpos(int i, int u) {     if (x[i] == u) return 0;     if (y[i] == u) return 1;     if (z[i] == u) return 2;   }   void dfs(int u, int v) {     cout << u <<    ;     if (cnt[v] == 0) {       cout << v;       return;     }     for (int i : a[u])       if (i) {         --cnt[x[i]];         --cnt[y[i]];         --cnt[z[i]];         int k = 3 - getpos(i, u) - getpos(i, v);         for (int &j : a[x[i]])           if (j == i) j = 0;         for (int &j : a[y[i]])           if (j == i) j = 0;         for (int &j : a[z[i]])           if (j == i) j = 0;         if (k == 0) dfs(v, x[i]);         if (k == 1) dfs(v, y[i]);         if (k == 2) dfs(v, z[i]);       }   }   int main() {     cin >> n;     for (int i = 1; i <= n - 2; ++i)       cin >> x[i] >> y[i] >> z[i], a[x[i]].push_back(i), a[y[i]].push_back(i),           a[z[i]].push_back(i), ++cnt[x[i]], ++cnt[y[i]], ++cnt[z[i]];     for (int i = 1; i <= n; ++i)       if (cnt[i] == 1) {         if (cnt[x[a[i][0]]] == 2) dfs(i, x[a[i][0]]);         if (cnt[y[a[i][0]]] == 2) dfs(i, y[a[i][0]]);         if (cnt[z[a[i][0]]] == 2) dfs(i, z[a[i][0]]);       }   }   