#include <bits/stdc++.h>
using namespace std;
static const int maxn = 1e5 + 5;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  vector<int> counter(n + 1);
  vector<vector<int> > row(n + 1);
  vector<vector<int> > whichRow(n + 1);
  for (int i = 1; i <= n - 2; i++) {
    for (int j = 1; j <= 3; j++) {
      int x;
      cin >> x;
      counter[x]++;
      row[x].push_back(i);
      whichRow[i].push_back(x);
    }
  }
  vector<vector<int> > vec(4);
  for (int i = 1; i <= n; i++) vec[counter[i]].push_back(i);
  vector<int> permutation(n + 1);
  vector<bool> vis(n + 1);
  int a = vec[1][0];
  int b = vec[1][1];
  if (row[a][0] > row[b][0]) swap(a, b);
  permutation[1] = a;
  permutation[n] = b;
  vis[a] = vis[b] = 1;
  int aa = vec[2][0];
  int bb = vec[2][1];
  bool ok = false;
  for (int x : whichRow[row[a][0]]) {
    if (x == aa) {
      ok = true;
      break;
    }
  }
  if (ok == false) swap(aa, bb);
  permutation[2] = aa;
  permutation[n - 1] = bb;
  vis[aa] = vis[bb] = 1;
  for (int i = 3; i <= n - 2; i++) {
    int pre = permutation[i - 2];
    int nxt = -1;
    for (int r : row[pre]) {
      if (nxt != -1) break;
      for (int x : whichRow[r]) {
        if (vis[x] == 0) {
          nxt = x;
          break;
        }
      }
    }
    assert(nxt != -1);
    vis[nxt] = 1;
    permutation[i] = nxt;
  }
  for (int i = 1; i <= n; i++) cout << permutation[i] << " \n"[i == n];
}
