#include <bits/stdc++.h>
using namespace std;
int m, n, t, pos, pos2;
const int N = 1e6 + 10;
int a[N][3], b[N], f[N];
vector<int> c[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n - 2; i++) {
    scanf("%d%d%d", &a[i][0], &a[i][1], &a[i][2]);
    b[a[i][0]]++;
    b[a[i][1]]++;
    b[a[i][2]]++;
    c[a[i][0]].push_back(i);
    c[a[i][1]].push_back(i);
    c[a[i][2]].push_back(i);
  }
  for (int i = 1; i <= n; i++)
    if (b[i] == 1) pos = i;
  for (int i = 0; i <= 2; i++)
    if (b[a[c[pos][0]][i]] == 2) pos2 = a[c[pos][0]][i];
  for (int i = 1; i <= n; i++)
    if (i != pos && i != pos2) b[i] = 3;
  for (int i = 1; i <= n - 2; i++) {
    printf("%d%c", pos, i == n ? '\n' : ' ');
    int tmp;
    for (int j = 0; j < c[pos].size(); j++)
      if (!f[c[pos][j]]) {
        f[c[pos][j]] = 1;
        for (int k = 0; k <= 2; k++)
          if (--b[a[c[pos][j]][k]] == 1) tmp = a[c[pos][j]][k];
      }
    pos = tmp;
  }
  for (int i = 1; i <= n; i++)
    if (b[i] == 1) printf("%d ", i);
  for (int i = 1; i <= n; i++)
    if (b[i] == 2) printf("%d\n", i);
  return 0;
}
