#include <bits/stdc++.h>   const int inf = 1500000000;   const int d = 1e9 + 7;   using namespace std;   struct triple {     int a;     int b;     int c;     bool flag;     triple() { flag = true; }   };   int main() {     int n;     cin >> n;     vector<triple> t(n - 1, triple());     vector<int> adj[n + 1];     for (int i = 1; i <= n - 2; i++) {       cin >> t[i].a >> t[i].b >> t[i].c;       adj[t[i].a].push_back(i);       adj[t[i].b].push_back(i);       adj[t[i].c].push_back(i);     }     int first;     triple f;     for (int i = 1; i <= n; i++) {       if (adj[i].size() == 1) {         first = i;         f = t[adj[i][0]];         break;       }     }     int second;     if (adj[f.a].size() == 2) {       second = f.a;     }     if (adj[f.b].size() == 2) {       second = f.b;     }     if (adj[f.c].size() == 2) {       second = f.c;     }     vector<int> perm;     perm.push_back(first);     perm.push_back(second);     while (perm.size() != n) {       int third;       for (int i = 0; i < adj[first].size(); i++) {         int ind = adj[first][i];         if (t[ind].flag == true) {           t[ind].flag = false;           third = (t[ind].a + t[ind].b + t[ind].c) - first - second;           perm.push_back(third);           first = second;           second = third;           break;         }       }     }     for (int i = 0; i < perm.size(); i++) cout << perm[i] <<    ;     return 0;   }   