#include <bits/stdc++.h>
int a[100005][4], pos[100005][3], ans[100005], used[100005];
void swap(int* a, int* b) {
  int tmp;
  tmp = *b;
  *b = *a;
  *a = tmp;
}
int find(int i) {
  for (int j = 0; j <= 2; j++) {
    for (int k = 0; k <= 2; k++) {
      if (pos[ans[i - 1]][j] == pos[ans[i - 2]][k] && pos[ans[i - 1]][j] != 0) {
        if (used[pos[ans[i - 1]][j]] == 0) {
          used[pos[ans[i - 1]][j]] = 1;
          return pos[ans[i - 1]][j];
        }
      }
    }
  }
  return 0;
}
int main() {
  int n, index = 0, tmp = 0, kaitou = 0, jiewei = 0, flag;
  scanf("%d", &n);
  for (int i = 1; i <= n - 2; i++) {
    for (int j = 1; j <= 3; j++) {
      scanf("%d", &a[i][j]);
      if (pos[a[i][j]][0] == 0)
        pos[a[i][j]][0] = i;
      else if (pos[a[i][j]][1] == 0)
        pos[a[i][j]][1] = i;
      else
        pos[a[i][j]][2] = i;
    }
  }
  if (n == 3) {
    for (int i = 1; i <= 3; i++) {
      printf("%d ", a[1][i]);
    }
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    if (pos[i][1] == 0) {
      index = pos[i][0];
      tmp = i;
      flag = i;
      kaitou = index;
      break;
    }
  }
  for (int i = 1; i <= 3; i++) {
    if (a[index][i] == tmp) swap(&a[index][i], &a[index][1]);
  }
  used[index] = 1;
  for (int i = 1; i <= 3; i++) {
    ans[i] = a[index][i];
  }
  for (int i = flag + 1; i <= n; i++) {
    if (pos[i][1] == 0) {
      index = pos[i][0];
      jiewei = index;
      break;
    }
  }
  used[index] = 1;
  for (int i = 1; i <= 3; i++) {
    if (pos[a[index][i]][1] == 0) {
      ans[n] = a[index][i];
      break;
    }
  }
  int ok = 1, oktmp = 0;
  for (int i = 4; i <= n - 1; i++) {
    int block = find(i);
    if (block == 0) {
      ok = 0;
      break;
    }
    for (int j = 1; j <= 3; j++) {
      if (a[block][j] != ans[i - 2] && a[block][j] != ans[i - 1]) {
        ans[i] = a[block][j];
        break;
      }
      if (j == 3) {
        ok = 0;
      }
    }
  }
  for (int i = n - 2; i <= n; i++) {
    oktmp = 0;
    for (int j = 1; j <= 3; j++) {
      if (ans[i] == a[jiewei][j]) oktmp = 1;
    }
    if (oktmp == 0) {
      ok = 0;
      break;
    }
  }
  if (ok) {
    for (int i = 1; i <= n; i++) {
      printf("%d ", ans[i]);
    }
  } else {
    memset(used, 0, sizeof(used));
    memset(pos, 0, sizeof(pos));
    used[kaitou] = used[jiewei] = 1;
    swap(&ans[2], &ans[3]);
    for (int i = 1; i <= n - 2; i++) {
      for (int j = 1; j <= 3; j++) {
        if (pos[a[i][j]][0] == 0)
          pos[a[i][j]][0] = i;
        else if (pos[a[i][j]][1] == 0)
          pos[a[i][j]][1] = i;
        else
          pos[a[i][j]][2] = i;
      }
    }
    for (int i = 4; i <= n - 1; i++) {
      int block = find(i);
      for (int j = 1; j <= 3; j++) {
        if (a[block][j] != ans[i - 2] && a[block][j] != ans[i - 1]) {
          ans[i] = a[block][j];
          break;
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      printf("%d ", ans[i]);
    }
  }
  return 0;
}
