#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int res = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (isdigit(ch)) {
    res = (res << 1) + (res << 3) + (ch ^ 48);
    ch = getchar();
  }
  return res * f;
}
inline void write(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
const int MAXN = 2e5 + 5;
const double EPS = 1e-6;
const double PI = acos(-1);
long long mod = 1e9 + 7;
int m, l, r, T, len, w, cnt;
int n;
int a[MAXN];
int q[MAXN][5];
struct point {
  int l;
  int r;
};
int num[MAXN];
int Rank[MAXN];
bool vis[MAXN];
vector<point> vec[MAXN];
bool cmp(int a, int b) { return num[a] < num[b]; }
void solve() {}
void init() {
  cin >> n;
  for (int i = 1, a, b, c; i <= n - 2; i++) {
    cin >> a >> b >> c;
    vec[a].push_back({b, c});
    vec[b].push_back({a, c});
    vec[c].push_back({b, a});
    num[a]++;
    num[b]++;
    num[c]++;
  }
  for (int i = 0; i <= n; i++) Rank[i] = i;
  sort(Rank + 1, Rank + 1 + n, cmp);
  queue<int> q;
  q.push(Rank[1]);
  num[Rank[1]] = 0;
  vis[Rank[1]] = true;
  while (!q.empty()) {
    int tmp = q.front();
    q.pop();
    cout << tmp << " ";
    for (auto i : vec[tmp]) {
      num[i.l]--;
      num[i.r]--;
      ;
      if (num[i.l] == 1 && num[i.r] == 1) {
        if (vec[i.l].size() > vec[i.r].size()) {
          if (vis[i.l] == false) q.push(i.l);
          if (vis[i.r] == false) q.push(i.r);
        } else {
          if (vis[i.r] == false) q.push(i.r);
          if (vis[i.l] == false) q.push(i.l);
        }
        vis[i.l] = vis[i.r] = true;
      } else if (num[i.l] == 1) {
        if (vis[i.l] == false) q.push(i.l);
        if (vis[i.r] == false) q.push(i.r);
        vis[i.l] = vis[i.r] = true;
      } else if (num[i.r] == 1) {
        if (vis[i.r] == false) q.push(i.r);
        if (vis[i.l] == false) q.push(i.l);
        vis[i.l] = vis[i.r] = true;
      }
    }
  }
  cout << Rank[2] << endl;
}
int main() {
  init();
  return 0;
}
