#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[100009][3];
  int b[100001][4] = {0};
  int c[100000];
  int z = 0;
  for (int i = 0; i < n - 2; i++) {
    for (int o = 0; o < 3; o++) {
      cin >> a[i][o];
      b[a[i][o]][b[a[i][o]][0] + 1] = i;
      b[a[i][o]][0]++;
    }
  }
  bool k = 0;
  for (int i = 1; i <= n; i++) {
    if (b[i][0] == 1 && k) {
      c[z++] = i;
      for (int o = 0; o < 3; o++) {
        if (b[a[b[i][1]][o]][0] == 2) {
          c[z++] = a[b[i][1]][o];
          b[a[b[i][1]][o]][0]--;
          for (int q = 1; q <= 2; q++) {
            if (b[a[b[i][1]][o]][q] == b[i][1]) {
              b[a[b[i][1]][o]][q] = -1;
              break;
            }
          }
          b[a[b[i][1]][o]][3] = -1;
          break;
        }
      }
      for (int o = 0; o < 3; o++) {
        if (b[a[b[i][1]][o]][0] == 3) {
          c[z++] = a[b[i][1]][o];
          b[a[b[i][1]][o]][0]--;
          for (int q = 1; q <= 3; q++) {
            if (b[a[b[i][1]][o]][q] == b[i][1]) {
              b[a[b[i][1]][o]][q] = -1;
            }
          }
          break;
        }
      }
      b[i][0]--;
      break;
    }
    if (!k && b[i][0] == 1) {
      c[n - 1] = i;
      b[i][2] = -1;
      b[i][3] = -1;
      int x = b[i][1];
      for (int o = 0; o < 3; o++) {
        int q = a[x][o];
        if (b[q][0] == 3) {
          c[n - 3] = q;
        }
      }
      for (int o = 0; o < 3; o++) {
        int q = a[x][o];
        if (b[q][0] == 2) {
          c[n - 2] = q;
          b[q][0]++;
        }
      }
      b[i][0] = 3;
      k = 1;
    }
  }
  while (z < n - 3) {
    int x;
    for (int i = 0; i < 3; i++) {
      if (b[c[z - 2]][i + 1] != -1) {
        x = b[c[z - 2]][i + 1];
        break;
      }
    }
    b[c[z - 2]][0]--;
    for (int o = 0; o < 3; o++) {
      if (b[a[x][o]][0] == 2) {
        b[a[x][o]][0]--;
        for (int i = 1; i <= 3; i++) {
          if (b[a[x][o]][i] == x) {
            b[a[x][o]][i] = -1;
            break;
          }
        }
      } else if (b[a[x][o]][0] == 3) {
        c[z++] = a[x][o];
        b[a[x][o]][0]--;
        for (int i = 1; i <= 3; i++) {
          if (b[a[x][o]][i] == x) {
            b[a[x][o]][i] = -1;
            break;
          }
        }
      }
    }
  }
  for (int i = 0; i < n; i++) cout << c[i] << ' ';
  cout << endl;
}
