#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+2;
vector<int> v[maxn];
int n,x,y,z;
int cnt[maxn];
int vis[maxn];
int main()
{
    cin>>n;
    for(int i=0;i<n-2;i++){
        cin>>x>>y>>z;
        cnt[x]++; cnt[y]++; cnt[z]++;
        v[x].push_back(y);v[x].push_back(z);
        v[y].push_back(x);v[y].push_back(z);
        v[z].push_back(y);v[z].push_back(x);
    }
    for(int i=1;i<=n;i++){
        if(cnt[i]==1){
            x=i;
            break;
        }
    }
    if(cnt[v[x][0]]==2)
        y=v[x][0];
    else
        y=v[x][1];
    vis[x]=vis[y]=1;
    cout<<x<<" "<<y<<" ";
    for(int i=0;i<n-2;i++){
        for(int j=0;j<v[x].size();j++){
            if(!vis[v[x][j]]){
                z=v[x][j];
            }
        }
        vis[z]=1;
        cout<<z<<" ";
        x = y;
        y = z;
    }
    return 0;
}


using namespace std;
const int maxn = 1e5+2;
vector<int> [maxn];
int n,x,y,z;
int cnt[maxn];
int vist[maxn];
int main()
{
    cin>>n;
    for(int i=0;i<n-2;i++){
        cin>>x>>y>>z;
        v[x].push_back(y);v[x].push_back(z);
        v[y].push_back(x);v[y].push_back(z);
        v[z].push_back(y);v[z].push_back(x);
    }
    for(int i=1;i<=n;i++){
        if(cnt[i]==1){
            x=i;
            break;
        }
    }
    if(cnt[v[x][0]]==2)
        y=v[x][0];
    else
        y=v[x][1];
    vis[x]=vis[y]=1;
    cout<<x<<" "<<y<<" ";
    for(int i=0;i<n-2;i++){
        for(int j=0;j<v[x].size();j++){
            if(!vis[v[x][j]]==0){
                z=v[x][j];
            }
        }
        vis[z]=1;
        cout<<z<<" ";
        x = y;
        y = z;
    }
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define N ((int)1e6+10)
#define MOD ((int)1e9+7)

using namespace std;

int n, m;
bool v[100005];
map<pair<int, int>, bool> mp;
map<pair<int, int>, vector<int> > g;
int a[100005][5];
pair<int, int> cnt[100005];

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cnt[i].second = i + 1;
    }

    m = n - 2;

    int mnIdx = 0;
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> a[i][j];
            if (!v[a[i][j]]) {
                mnIdx = i;
            }
            v[a[i][j]] = true;
        }
        sort(a[i], a[i] + 3);

        g[make_pair(a[i][0], a[i][1])].push_back(i);
        g[make_pair(a[i][0], a[i][2])].push_back(i);
        g[make_pair(a[i][1], a[i][2])].push_back(i);
    }
    memset(v, 0, sizeof(v));
    int idx = mnIdx;
    for (int i = 0; i < m; i++) {
        v[idx] = true;
        for (int j = 0; j < 3; j++) {
            if (cnt[a[idx][j] - 1].first != 0)
                cnt[a[idx][j] - 1].first++;
            else
                cnt[a[idx][j] - 1].first += (i + 1) * 3;
        }
        for (int j = 0; j < 3; j++)
            for (int k = j + 1; k < 3; k++) {
                pair<int, int> key = make_pair(a[idx][j], a[idx][k]);
                for (int h = 0; h < g[key].size(); h++) {
                    if (v[g[key][h]])
                        continue;
                    idx = g[key][h];
                }
            }
    }
    sort(cnt,cnt+n);
    for(int i = 0 ; i < n;i++){
        cout << cnt[i].second;
        if(i + 1 != n)
            cout << " ";
    }
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define N ((int)1e6+10)
#define MOD ((int)1e9+7)

using namespace std;

int n, m;
bool v[100005];
map<pair<int, int>, bool> mp;
map<pair<int, int>, vector<int> > g;
int a[100005][5];
pair<int, int> cnt[100005];

int main() {
    cin >> n;

    m = n - 2;

    int mnIdx = 0;
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> a[i][j];
            cnt[a[i][j]].first++;
            cnt[a[i][j]].second = i;
        }
        sort(a[i], a[i] + 3);

        g[make_pair(a[i][0], a[i][1])].push_back(i);
        g[make_pair(a[i][0], a[i][2])].push_back(i);
        g[make_pair(a[i][1], a[i][2])].push_back(i);
    }
    for(int i =1 ; i <= n;i++){
        if(cnt[i].first == 1){
            mnIdx = cnt[i].second;
            break;
        }
    }
    int idx = mnIdx;

    for (int i = 0; i < n; i++) {
        cnt[i].second = i + 1;
        cnt[i].first = 0;
    }
    for (int i = 0; i < m; i++) {
        v[idx] = true;
        for (int j = 0; j < 3; j++) {
            if (cnt[a[idx][j] - 1].first != 0)
                cnt[a[idx][j] - 1].first++;
            else
                cnt[a[idx][j] - 1].first += (i + 1) * 3;
        }
        for (int j = 0; j < 3; j++)
            for (int k = j + 1; k < 3; k++) {
                pair<int, int> key = make_pair(a[idx][j], a[idx][k]);
                for (int h = 0; h < g[key].size(); h++) {
                    if (v[g[key][h]])
                        continue;
                    idx = g[key][h];
                }
            }
    }
    sort(cnt,cnt+n);
    for(int i = 0 ; i < n;i++){
        cout << cnt[i].second;
        if(i + 1 != n)
            cout << " ";
    }
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define N ((int)1e6+10)
#define MOD ((int)1e9+7)

using namespace std;

int n, m;
bool v[100005];
map<pair<int, int>, bool> mp;
map<pair<int, int>, vector<int> > g;
int a[100005][5];
pair<int, int> cnt[100005];

int main() {
    cin >> n;

    m = n - 2;

    int mnIdx = 0;
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> a[i][j];
            cnt[a[i][j]].first++;
            cnt[a[i][j]].second = i;
        }
        sort(a[i], a[i] + 3);

        g[make_pair(a[i][0], a[i][1])].push_back(i);
        g[make_pair(a[i][0], a[i][2])].push_back(i);
        g[make_pair(a[i][1], a[i][2])].push_back(i);
    }
    for(int i =0 ; i < n;i++){
        if(cnt[i].first == 1){
            mnIdx = cnt[i].second;
            break;
        }
    }
    int idx = mnIdx;

    for (int i = 0; i < n; i++) {
        cnt[i].second = i + 1;
        cnt[i].first = 0;
    }
    for (int i = 0; i < m; i++) {
        v[idx] = true;
        for (int j = 0; j < 3; j++) {
            if (cnt[a[idx][j] - 1].first != 0)
                cnt[a[idx][j] - 1].first++;
            else
                cnt[a[idx][j] - 1].first += (i + 1) * 3;
        }
        int iidx = 0;
        for (int j = 0; j < 3; j++)
            for (int k = j + 1; k < 3; k++) {
                pair<int, int> key = make_pair(a[idx][j], a[idx][k]);
                for (int h = 0; h < g[key].size(); h++) {
                    if (v[g[key][h]])
                        continue;
                    iidx = g[key][h];

                }
            }
        idx = iidx;
    }
    sort(cnt,cnt+n);
    for(int i = 0 ; i < n;i++){
        cout << cnt[i].second;
        if(i + 1 != n)
            cout << " ";
    }
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define N ((int)1e6+10)
#define MOD ((int)1e9+7)

using namespace std;

int n, m;
bool v[100005];
map<pair<int, int>, bool> mp;
map<pair<int, int>, vector<int> > g;
int a[100005][5];
pair<int, int> cnt[100005];

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cnt[i].second = i + 1;
    }

    m = n - 2;

    int mnIdx = 0;
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> a[i][j];
            if (!v[a[i][j]]) {
                mnIdx = i;
            }
            v[a[i][j]] = true;
        }
        sort(a[i], a[i] + 3);

        g[make_pair(a[i][0], a[i][1])].push_back(i);
        g[make_pair(a[i][0], a[i][2])].push_back(i);
        g[make_pair(a[i][1], a[i][2])].push_back(i);
    }
    memset(v, 0, sizeof(v));
    int idx = mnIdx;
    for (int i = 0; i < m; i++) {
        v[idx] = true;
        for (int j = 0; j < 3; j++) {
            if (cnt[a[idx][j] - 1].first != 0)
                cnt[a[idx][j] - 1].first++;
            else
                cnt[a[idx][j] - 1].first += (i + 1) * 3;
        }
        for (int j = 0; j < 3; j++)
            for (int k = j + 1; k < 3; k++) {
                pair<int, int> key = make_pair(a[idx][j], a[idx][k]);
                for (int h = 0; h < g[key].size(); h++) {
                    if (v[g[key][h]])
                        continue;
                    idx = g[key][h];
                }
            }
    }
    sort(cnt,cnt+n);
    for(int i = 0 ; i < n;i++){
        cout << cnt[i].second;
        if(i + 1 == n)
            cout << " ";
    }
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 1e9;
const ll INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;

map< pair<int,int>,vector<int> > adj;
int cnt[100010];
pair< pair<int,int>,int > tab[100010];
bool vis[100010];
vector<int> ans;
int head,tail;
int n;

bool dfsCek(int curL,int curR) {
	vis[curL] = 1;
	vis[curR] = 1;
	if (curR == tail) return true;
	bool ret = false;
	for (int i = 0 ; i < adj[{curL,curR}].size() ; i++) {
		int ix = adj[{curL,curR}][i];
		int nxt;
		vector<int> tmp(3);
		tmp[0] = tab[ix].first.first;
		tmp[1] = tab[ix].first.second;
		tmp[2] = tab[ix].second;
		sort(tmp.begin(),tmp.end());
		int mx = max(curL,curR);
		int mn = min(curL,curR);
		if (tmp[0] == mn && tmp[1] == mx)
			nxt = tmp[2];
		else
		if (tmp[0] == mn && tmp[2] == mx)
			nxt = tmp[1];
		else
		if (tmp[1] == mn && tmp[2] == mx)
			nxt = tmp[0];
		else
			assert(false);
		if (!vis[nxt])
			ret |= dfsCek(curR,nxt);
	}
	return ret;
}

void dfsFill(int curL,int curR) {
	vis[curL] = 1;
	vis[curR] = 1;
	if (curR == tail) {
		return;
	}
	bool ret = false;
	for (int i = 0 ; i < adj[{curL,curR}].size() ; i++) {
		int ix = adj[{curL,curR}][i];
		int nxt;
		vector<int> tmp(3);
		tmp[0] = tab[ix].first.first;
		tmp[1] = tab[ix].first.second;
		tmp[2] = tab[ix].second;
		sort(tmp.begin(),tmp.end());
		int mx = max(curL,curR);
		int mn = min(curL,curR);
		if (tmp[0] == mn && tmp[1] == mx)
			nxt = tmp[2];
		else
		if (tmp[0] == mn && tmp[2] == mx)
			nxt = tmp[1];
		else
		if (tmp[1] == mn && tmp[2] == mx)
			nxt = tmp[0];
		else
			assert(false);
		if (!vis[nxt]) {
			ans.push_back(nxt);
			dfsFill(curR,nxt);
		}
	}
	return;
}

void process() {
	memset(vis,0,sizeof(vis));
	for (int i = 1 ; i <= n ; i++) {
		if (tab[i].first.first == head) {
			ans.push_back(tab[i].first.first);
			if (dfsCek(tab[i].first.second,tab[i].second)) {
				ans.push_back(tab[i].first.second);
				ans.push_back(tab[i].second);
				dfsFill(tab[i].first.second,tab[i].second);
			}
			else {
				ans.push_back(tab[i].second);
				ans.push_back(tab[i].first.second);
				dfsFill(tab[i].second,tab[i].first.second);
			}
		}
		else if (tab[i].first.second == head) {
			ans.push_back(tab[i].first.second);
			vis[head] = 1;
			if (dfsCek(tab[i].first.first,tab[i].second)) {
				ans.push_back(tab[i].first.first);
				ans.push_back(tab[i].second);
				memset(vis,0,sizeof(vis));
				vis[head] = 1;
				dfsFill(tab[i].first.first,tab[i].second);
			}
			else {
				ans.push_back(tab[i].second);
				ans.push_back(tab[i].first.first);
				memset(vis,0,sizeof(vis));
				vis[head] = 1;
				dfsFill(tab[i].second,tab[i].first.first);
			}
		}
		else if (tab[i].second == head) {
			ans.push_back(tab[i].second);
			if (dfsCek(tab[i].first.first,tab[i].first.second)) {
				ans.push_back(tab[i].first.first);
				ans.push_back(tab[i].first.second);
				dfsFill(tab[i].first.first,tab[i].first.second);
			}
			else {
				ans.push_back(tab[i].first.second);
				ans.push_back(tab[i].first.first);
				dfsFill(tab[i].first.second,tab[i].first.first);
			}
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for (int i = 1 ; i <= n - 2 ; i++) {
		int a,b,c;
		cin >> a >> b >> c;
		cnt[a]++;
		cnt[b]++;
		cnt[c]++;
		adj[{a,b}].push_back(i);
		adj[{b,a}].push_back(i);
		adj[{a,c}].push_back(i);
		adj[{c,a}].push_back(i);
		adj[{b,c}].push_back(i);
		adj[{c,b}].push_back(i);
		tab[i] = {{a,b},c};
	}
	head = -1;
	tail = -1;
	for (int i = 1 ; i <= n ; i++) if (cnt[i] == 1) {
		if (head == -1)
			head = i;
		else
			tail = i;
	}
	process();
	if (ans.size() != n) {
		ans.clear();
		swap(head,tail);
		process();
	}
	assert(ans.size() == n);
	for (int i = 0 ; i < n ; i++)
		cout << ans[i] << " ";
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 1e9;
const ll INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;

map< pair<int,int>,vector<int> > adj;
int cnt[100010];
pair< pair<int,int>,int > tab[100010];
bool vis[100010];
vector<int> ans;
int head,tail;
int n;

bool dfsCek(int curL,int curR) {
	vis[curL] = 1;
	vis[curR] = 1;
	if (curR == tail) return true;
	bool ret = false;
	for (int i = 0 ; i < adj[{curL,curR}].size() ; i++) {
		int ix = adj[{curL,curR}][i];
		int nxt;
		vector<int> tmp(3);
		tmp[0] = tab[ix].first.first;
		tmp[1] = tab[ix].first.second;
		tmp[2] = tab[ix].second;
		sort(tmp.begin(),tmp.end());
		int mx = max(curL,curR);
		int mn = min(curL,curR);
		if (tmp[0] == mn && tmp[1] == mx)
			nxt = tmp[2];
		else
		if (tmp[0] == mn && tmp[2] == mx)
			nxt = tmp[1];
		else
		if (tmp[1] == mn && tmp[2] == mx)
			nxt = tmp[0];
		else
			assert(false);
		if (!vis[nxt])
			ret |= dfsCek(curR,nxt);
	}
	return ret;
}

void dfsFill(int curL,int curR) {
	vis[curL] = 1;
	vis[curR] = 1;
	if (curR == tail) {
		return;
	}
	bool ret = false;
	for (int i = 0 ; i < adj[{curL,curR}].size() ; i++) {
		int ix = adj[{curL,curR}][i];
		int nxt;
		vector<int> tmp(3);
		tmp[0] = tab[ix].first.first;
		tmp[1] = tab[ix].first.second;
		tmp[2] = tab[ix].second;
		sort(tmp.begin(),tmp.end());
		int mx = max(curL,curR);
		int mn = min(curL,curR);
		if (tmp[0] == mn && tmp[1] == mx)
			nxt = tmp[2];
		else
		if (tmp[0] == mn && tmp[2] == mx)
			nxt = tmp[1];
		else
		if (tmp[1] == mn && tmp[2] == mx)
			nxt = tmp[0];
		else
			assert(false);
		if (!vis[nxt]) {
			ans.push_back(nxt);
			dfsFill(curR,nxt);
		}
	}
	return;
}

void process() {
	for (int i = 1 ; i <= n ; i++) {
		if (tab[i].first.first == head) {
			ans.push_back(tab[i].first.first);
			if (dfsCek(tab[i].first.second,tab[i].second)) {
				ans.push_back(tab[i].first.second);
				ans.push_back(tab[i].second);
				dfsFill(tab[i].first.second,tab[i].second);
			}
			else {
				ans.push_back(tab[i].second);
				ans.push_back(tab[i].first.second);
				dfsFill(tab[i].second,tab[i].first.second);
			}
		}
		else if (tab[i].first.second == head) {
			ans.push_back(tab[i].first.second);
			vis[head] = 1;
			if (dfsCek(tab[i].first.first,tab[i].second)) {
				ans.push_back(tab[i].first.first);
				ans.push_back(tab[i].second);
				memset(vis,0,sizeof(vis));
				vis[head] = 1;
				dfsFill(tab[i].first.first,tab[i].second);
			}
			else {
				ans.push_back(tab[i].second);
				ans.push_back(tab[i].first.first);
				memset(vis,0,sizeof(vis));
				vis[head] = 1;
				dfsFill(tab[i].second,tab[i].first.first);
			}
		}
		else if (tab[i].second == head) {
			ans.push_back(tab[i].second);
			if (dfsCek(tab[i].first.first,tab[i].first.second)) {
				ans.push_back(tab[i].first.first);
				ans.push_back(tab[i].first.second);
				dfsFill(tab[i].first.first,tab[i].first.second);
			}
			else {
				ans.push_back(tab[i].first.second);
				ans.push_back(tab[i].first.first);
				dfsFill(tab[i].first.second,tab[i].first.first);
			}
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for (int i = 1 ; i <= n - 2 ; i++) {
		int a,b,c;
		cin >> a >> b >> c;
		cnt[a]++;
		cnt[b]++;
		cnt[c]++;
		adj[{a,b}].push_back(i);
		adj[{b,a}].push_back(i);
		adj[{a,c}].push_back(i);
		adj[{c,a}].push_back(i);
		adj[{b,c}].push_back(i);
		adj[{c,b}].push_back(i);
		tab[i] = {{a,b},c};
	}
	head = -1;
	tail = -1;
	for (int i = 1 ; i <= n ; i++) if (cnt[i] == 1) {
		if (head == -1)
			head = i;
		else
			tail = i;
	}
	process();
	if (ans.size() != n) {
		ans.clear();
		swap(head,tail);
		process();
	}
	for (int i = 0 ; i < n ; i++)
		cout << ans[i] << " ";
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 1e9;
const ll INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;

map< pair<int,int>,vector<int> > adj;
int cnt[100010];
pair< pair<int,int>,int > tab[100010];
bool vis[100010];
vector<int> ans;
int head,tail;
int n;

bool dfsCek(int curL,int curR) {
	vis[curL] = 1;
	vis[curR] = 1;
	if (curR == tail) return true;
	bool ret = false;
	for (int i = 0 ; i < adj[{curL,curR}].size() ; i++) {
		int ix = adj[{curL,curR}][i];
		int nxt;
		vector<int> tmp(3);
		tmp[0] = tab[ix].first.first;
		tmp[1] = tab[ix].first.second;
		tmp[2] = tab[ix].second;
		sort(tmp.begin(),tmp.end());
		int mx = max(curL,curR);
		int mn = min(curL,curR);
		if (tmp[0] == mn && tmp[1] == mx)
			nxt = tmp[2];
		else
		if (tmp[0] == mn && tmp[2] == mx)
			nxt = tmp[1];
		else
		if (tmp[1] == mn && tmp[2] == mx)
			nxt = tmp[0];
		else
			assert(false);
		if (!vis[nxt])
			ret |= dfsCek(curR,nxt);
	}
	return ret;
}

void dfsFill(int curL,int curR) {
	vis[curL] = 1;
	vis[curR] = 1;
	if (curR == tail) {
		return;
	}
	bool ret = false;
	for (int i = 0 ; i < adj[{curL,curR}].size() ; i++) {
		int ix = adj[{curL,curR}][i];
		int nxt;
		vector<int> tmp(3);
		tmp[0] = tab[ix].first.first;
		tmp[1] = tab[ix].first.second;
		tmp[2] = tab[ix].second;
		sort(tmp.begin(),tmp.end());
		int mx = max(curL,curR);
		int mn = min(curL,curR);
		if (tmp[0] == mn && tmp[1] == mx)
			nxt = tmp[2];
		else
		if (tmp[0] == mn && tmp[2] == mx)
			nxt = tmp[1];
		else
		if (tmp[1] == mn && tmp[2] == mx)
			nxt = tmp[0];
		else
			assert(false);
		if (!vis[nxt]) {
			ans.push_back(nxt);
			dfsFill(curR,nxt);
		}
	}
	return;
}

void process() {
	memset(vis,0,sizeof(vis));
	for (int i = 1 ; i <= n ; i++) {
		if (tab[i].first.first == head) {
			ans.push_back(tab[i].first.first);
			if (dfsCek(tab[i].first.second,tab[i].second)) {
				ans.push_back(tab[i].first.second);
				ans.push_back(tab[i].second);
				memset(vis,0,sizeof(vis));
				vis[head] = 1;
				dfsFill(tab[i].first.second,tab[i].second);
			}
			else {
				ans.push_back(tab[i].second);
				ans.push_back(tab[i].first.second);
				memset(vis,0,sizeof(vis));
				vis[head] = 1;
				dfsFill(tab[i].second,tab[i].first.second);
			}
		}
		else if (tab[i].first.second == head) {
			ans.push_back(tab[i].first.second);
			vis[head] = 1;
			if (dfsCek(tab[i].first.first,tab[i].second)) {
				ans.push_back(tab[i].first.first);
				ans.push_back(tab[i].second);
				memset(vis,0,sizeof(vis));
				vis[head] = 1;
				dfsFill(tab[i].first.first,tab[i].second);
			}
			else {
				ans.push_back(tab[i].second);
				ans.push_back(tab[i].first.first);
				memset(vis,0,sizeof(vis));
				vis[head] = 1;
				dfsFill(tab[i].second,tab[i].first.first);
			}
		}
		else if (tab[i].second == head) {
			ans.push_back(tab[i].second);
			if (dfsCek(tab[i].first.first,tab[i].first.second)) {
				ans.push_back(tab[i].first.first);
				ans.push_back(tab[i].first.second);
				memset(vis,0,sizeof(vis));
				vis[head] = 1;
				dfsFill(tab[i].first.first,tab[i].first.second);
			}
			else {
				ans.push_back(tab[i].first.second);
				ans.push_back(tab[i].first.first);
				memset(vis,0,sizeof(vis));
				vis[head] = 1;
				dfsFill(tab[i].first.second,tab[i].first.first);
			}
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for (int i = 1 ; i <= n - 2 ; i++) {
		int a,b,c;
		cin >> a >> b >> c;
		cnt[a]++;
		cnt[b]++;
		cnt[c]++;
		adj[{a,b}].push_back(i);
		adj[{b,a}].push_back(i);
		adj[{a,c}].push_back(i);
		adj[{c,a}].push_back(i);
		adj[{b,c}].push_back(i);
		adj[{c,b}].push_back(i);
		tab[i] = {{a,b},c};
	}
	head = -1;
	tail = -1;
	for (int i = 1 ; i <= n ; i++) if (cnt[i] == 1) {
		if (head == -1)
			head = i;
		else
			tail = i;
	}
	process();
	if (ans.size() != n) {
		ans.clear();
		swap(head,tail);
		process();
	}
	assert(ans.size() == n);
	for (int i = 0 ; i < n ; i++)
		cout << ans[i] << " ";
	cout << endl;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 1e9;
const ll INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;

map< pair<int,int>,vector<int> > adj;
int cnt[100010];
pair< pair<int,int>,int > tab[100010];
bool vis[100010];
vector<int> ans;
int head,tail;

bool dfsCek(int curL,int curR) {
	vis[curL] = 1;
	vis[curR] = 1;
	if (curR == tail) return true;
	bool ret = false;
	for (int i = 0 ; i < adj[{curL,curR}].size() ; i++) {
		int ix = adj[{curL,curR}][i];
		int nxt;
		vector<int> tmp(3);
		tmp[0] = tab[ix].first.first;
		tmp[1] = tab[ix].first.second;
		tmp[2] = tab[ix].second;
		sort(tmp.begin(),tmp.end());
		int mx = max(curL,curR);
		int mn = min(curL,curR);
		if (tmp[0] == mn && tmp[1] == mx)
			nxt = tmp[2];
		else
		if (tmp[0] == mn && tmp[2] == mx)
			nxt = tmp[1];
		else
		if (tmp[1] == mn && tmp[2] == mx)
			nxt = tmp[0];
		else
			assert(false);
		if (!vis[nxt])
			ret |= dfsCek(curR,nxt);
	}
	return ret;
}

void dfsFill(int curL,int curR) {
	vis[curL] = 1;
	vis[curR] = 1;
	if (curR == tail) {
		return;
	}
	bool ret = false;
	for (int i = 0 ; i < adj[{curL,curR}].size() ; i++) {
		int ix = adj[{curL,curR}][i];
		int nxt;
		vector<int> tmp(3);
		tmp[0] = tab[ix].first.first;
		tmp[1] = tab[ix].first.second;
		tmp[2] = tab[ix].second;
		sort(tmp.begin(),tmp.end());
		int mx = max(curL,curR);
		int mn = min(curL,curR);
		if (tmp[0] == mn && tmp[1] == mx)
			nxt = tmp[2];
		else
		if (tmp[0] == mn && tmp[2] == mx)
			nxt = tmp[1];
		else
		if (tmp[1] == mn && tmp[2] == mx)
			nxt = tmp[0];
		else
			assert(false);
		if (!vis[nxt]) {
			ans.push_back(nxt);
			dfsFill(curR,nxt);
		}
	}
	return;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	for (int i = 1 ; i <= n - 2 ; i++) {
		int a,b,c;
		cin >> a >> b >> c;
		cnt[a]++;
		cnt[b]++;
		cnt[c]++;
		adj[{a,b}].push_back(i);
		adj[{b,a}].push_back(i);
		adj[{a,c}].push_back(i);
		adj[{c,a}].push_back(i);
		adj[{b,c}].push_back(i);
		adj[{c,b}].push_back(i);
		tab[i] = {{a,b},c};
	}
	head = -1;
	tail = -1;
	for (int i = 1 ; i <= n ; i++) if (cnt[i] == 1) {
		if (head == -1)
			head = i;
		else
			tail = i;
	}
	for (int i = 1 ; i <= n ; i++) {
		if (tab[i].first.first == head) {
			ans.push_back(tab[i].first.first);
			if (dfsCek(tab[i].first.second,tab[i].second)) {
				ans.push_back(tab[i].first.second);
				ans.push_back(tab[i].second);
				dfsFill(tab[i].first.second,tab[i].second);
			}
			else {
				ans.push_back(tab[i].second);
				ans.push_back(tab[i].first.second);
				dfsFill(tab[i].second,tab[i].first.second);
			}
		}
		else if (tab[i].first.second == head) {
			ans.push_back(tab[i].first.second);
			vis[head] = 1;
			if (dfsCek(tab[i].first.first,tab[i].second)) {
				ans.push_back(tab[i].first.first);
				ans.push_back(tab[i].second);
				memset(vis,0,sizeof(vis));
				vis[head] = 1;
				dfsFill(tab[i].first.first,tab[i].second);
			}
			else {
				ans.push_back(tab[i].second);
				ans.push_back(tab[i].first.first);
				memset(vis,0,sizeof(vis));
				vis[head] = 1;
				dfsFill(tab[i].second,tab[i].first.first);
			}
		}
		else if (tab[i].second == head) {
			ans.push_back(tab[i].second);
			if (dfsCek(tab[i].first.first,tab[i].first.second)) {
				ans.push_back(tab[i].first.first);
				ans.push_back(tab[i].first.second);
				dfsFill(tab[i].first.first,tab[i].first.second);
			}
			else {
				ans.push_back(tab[i].first.second);
				ans.push_back(tab[i].first.first);
				dfsFill(tab[i].first.second,tab[i].first.first);
			}
		}
	}
	assert(ans.size() == n);
	for (int i = 0 ; i < n ; i++)
		cout << ans[i] << " ";
	cout << endl;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
const double inf=1e9;
typedef long long ll;
typedef pair<ll,ll>pr;
const ll mod=998244353;
ll _pow(ll  a,ll b) {
    ll ans=1;
    while(b) {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
ll gcd(ll a,ll b){
    if(!b) return a;
    else return gcd(b,a%b);
}
vector<int>g[maxn];
int vis[maxn],d[maxn];
vector<int>ans;
void dfs(int s){
    vis[s]=1;
    for(int i=0;i<g[s].size();i++){
        int v=g[s][i];
        //cout<<s<<" "<<v<<endl;
        if(vis[v]||d[v]!=3) continue;
        ans.push_back(v);
        dfs(v);
    }
}
struct node{
    int x,y,z;
}a[maxn];
int main(){
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin>>n;
  for(int i=1;i<=n-2;i++){
     cin>>a[i].x>>a[i].y>>a[i].z;
     d[a[i].x]++;
     d[a[i].y]++;
     d[a[i].z]++;
     g[a[i].x].push_back(a[i].y);
     g[a[i].y].push_back(a[i].x);
     g[a[i].y].push_back(a[i].z);
     g[a[i].z].push_back(a[i].y);
  }
  int id;
  for(int i=1;i<=n;i++){
      if(d[i]==1){
        id=i;
        break;
      }
  }
  /*for(int i=1;i<=n;i++){
    cout<<d[i]<<" ";
  }
  cout<<endl;
  */
  vis[id]=1;
  ans.push_back(id);
  for(int i=1;i<=n-2;i++){
     int x=a[i].x,y=a[i].y,z=a[i].z;
     if(id==x){
        if(d[y]==2) id=y;
        else if(d[z]==2) id=z;
     }
     if(id==y){
        if(d[x]==2) id=x;
        else if(d[z]==2) id=z;
     }
     if(id==z){
        if(d[x]==2) id=x;
        else if(d[y]==2) id=y;
     }
  }
  vis[id]=1;
  ans.push_back(id);
  /*for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
  */
  int cnt1=ans[0],cnt2=ans[1];
  for(int i=1;i<=n-2;i++){
     int x=a[i].x,y=a[i].y,z=a[i].z;
     if(x==cnt1&&y==cnt2&&!vis[z]) id=z;
     if(x==cnt1&&z==cnt2&&!vis[y]) id=y;
     if(y==cnt1&&z==cnt2&&!vis[x]) id=x;
     if(y==cnt1&&x==cnt2&&!vis[z]) id=z;
     if(z==cnt1&&x==cnt2&&!vis[y]) id=y;
     if(z==cnt1&&y==cnt2&&!vis[x]) id=x;
  }
  //cout<<id<<endl;
  ans.push_back(id);
  dfs(id);
  int s1,s2;
  for(int i=1;i<=n;i++){
      if(d[i]==2&&!vis[i]){
        vis[i]=1;
        s1=i;
      }
      if(d[i]==1&&!vis[i]){
        vis[i]=1;
        s2=i;
      }
  }
  ans.push_back(s1);
  ans.push_back(s2);
  for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  return 0;
}
/*
6
1 3 5
2 3 5
2 4 6
4 2 3
*/


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
int n,x,y,z;
vector<int> v[maxn];
int cnt[maxn];
bool vis[maxn];
int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	for(int i = 0;i < n - 2;i++){
		cin >> x >> y >> z;
		cnt[x]++; cnt[y]++; cnt[z]++;
		v[x].push_back(y); v[x].push_back(z);
		v[y].push_back(x); v[y].push_back(z);
		v[z].push_back(x); v[z].push_back(y);
	}
	for(int i = 1;i <= n;i++) if(cnt[i] == 1) x = i;
	if(cnt[v[x][0]] == 2) y = v[x][0];
	else y = v[x][1];
	vis[x] = vis[y] = 1;
	cout << x << " " << y << " ";
	for(int i = 0;i < n-2;i++){
		for(int j = 0;j < v[x].size();j++){
			if(!vis[v[x][j]]) z = v[x][j];
		}
		vis[z] = 1;
		cout << z << " ";
		x = y;
		y = z;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
const double inf=1e9;
typedef long long ll;
typedef pair<ll,ll>pr;
const ll mod=998244353;
ll _pow(ll  a,ll b) {
    ll ans=1;
    while(b) {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
ll gcd(ll a,ll b){
    if(!b) return a;
    else return gcd(b,a%b);
}
vector<int>g[maxn];
int vis[maxn],d[maxn];
vector<int>ans;
void dfs(int s){
    for(int i=0;i<g[s].size();i++){
        int v=g[s][i];
        if(vis[v]||d[v]!=3) continue;
        vis[v]=1;
        ans.push_back(v);
        dfs(v);
    }
}
struct node{
    int x,y,z;
}a[maxn];
int main(){
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin>>n;
  for(int i=1;i<=n-2;i++){
     cin>>a[i].x>>a[i].y>>a[i].z;
     d[a[i].x]++;
     d[a[i].y]++;
     d[a[i].z]++;
     g[a[i].x].push_back(a[i].y);
     g[a[i].y].push_back(a[i].x);
     g[a[i].y].push_back(a[i].z);
     g[a[i].z].push_back(a[i].y);
  }
  int id;
  for(int i=1;i<=n;i++){
      if(d[i]==1){
        id=i;
        break;
      }
  }
  vis[id]=1;
  ans.push_back(id);
  for(int i=1;i<=n-2;i++){
     int x=a[i].x;
     int y=a[i].y;
     int z=a[i].z;
     if(id==x){
        if(d[y]==2) id=y;
        if(d[z]==2) id=z;
     }
     if(id==y){
        if(d[x]==2) id=x;
        if(d[z]==2) id=z;
     }
     if(id==z){
        if(d[x]==2) id=x;
        if(d[y]==2) id=y;
     }
  }
  vis[id]=1;
  ans.push_back(id);
  /*for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
  */
  int cnt1=ans[0],cnt2=ans[1];
  for(int i=1;i<=n-2;i++){
     int x=a[i].x,y=a[i].y,z=a[i].z;
     if(x==cnt1&&y==cnt2&&!vis[z]&&d[z]==3) id=z;
     if(x==cnt1&&z==cnt2&&!vis[y]&&d[y]==3) id=y;
     if(y==cnt1&&z==cnt2&&!vis[x]&&d[x]==3) id=x;
     if(y==cnt1&&x==cnt2&&!vis[z]&&d[z]==3) id=z;
     if(z==cnt1&&x==cnt2&&!vis[y]&&d[y]==3) id=y;
     if(z==cnt1&&y==cnt2&&!vis[x]&&d[x]==3) id=x;
  }
  //cout<<id<<endl;
  vis[id]=1;
  ans.push_back(id);
  dfs(id);
  int s1,s2;
  for(int i=1;i<=n;i++){
      if(d[i]==2&&!vis[i]){
        vis[i]=1;
        s1=i;
      }
      if(d[i]==1&&!vis[i]){
        vis[i]=1;
        s2=i;
      }
  }
  ans.push_back(s1);
  ans.push_back(s2);
  for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  return 0;
}
/*
6
1 3 5
2 3 5
2 4 6
4 2 3
*/


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
const double inf=1e9;
typedef long long ll;
typedef pair<ll,ll>pr;
const ll mod=998244353;
ll _pow(ll  a,ll b) {
    ll ans=1;
    while(b) {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
ll gcd(ll a,ll b){
    if(!b) return a;
    else return gcd(b,a%b);
}
vector<int>g[maxn];
int vis[maxn],d[maxn];
vector<int>ans;
void dfs(int s){
    for(int i=0;i<g[s].size();i++){
        int v=g[s][i];
        if(vis[v]||d[v]!=3) continue;
        vis[v]=1;
        ans.push_back(v);
        dfs(v);
    }
}
struct node{
    int x,y,z;
}a[maxn];
int main(){
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin>>n;
  for(int i=1;i<=n-2;i++){
     cin>>a[i].x>>a[i].y>>a[i].z;
     d[a[i].x]++;
     d[a[i].y]++;
     d[a[i].z]++;
     g[a[i].x].push_back(a[i].y);
     g[a[i].y].push_back(a[i].x);
     g[a[i].y].push_back(a[i].z);
     g[a[i].z].push_back(a[i].y);
  }
  int id;
  for(int i=1;i<=n;i++){
      if(d[i]==1){
        id=i;
        break;
      }
  }
  /*for(int i=1;i<=n;i++){
    cout<<d[i]<<" ";
  }
  cout<<endl;
  */

  vis[id]=1;
  ans.push_back(id);
  //cout<<id<<endl;
  for(int i=1;i<=n-2;i++){
     int x=a[i].x;
     int y=a[i].y;
     int z=a[i].z;
     if(id==x){
        if(d[y]==2){
            id=y;
            break;
        }
        else if(d[z]==2){
            id=z;
            break;
        }
     }
     else if(id==y){
        if(d[x]==2){
            id=x;
            break;
        }
        else if(d[z]==2){
            id=z;
            break;
        }
     }
     else if(id==z){
        if(d[x]==2){
            id=x;
            break;
        }
        else if(d[y]==2){
            id=y;
            break;
        }

     }
  }
  vis[id]=1;
  ans.push_back(id);
  /*for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
  */
  int cnt1=ans[0],cnt2=ans[1];
  //cout<<cnt1<<" "<<cnt2<<endl;
  for(int i=1;i<=n-2;i++){
     int x=a[i].x,y=a[i].y,z=a[i].z;
     if(x==cnt1&&y==cnt2&&!vis[z]&&d[z]==3) id=z;
     if(x==cnt1&&z==cnt2&&!vis[y]&&d[y]==3) id=y;
     if(y==cnt1&&z==cnt2&&!vis[x]&&d[x]==3) id=x;
     if(y==cnt1&&x==cnt2&&!vis[z]&&d[z]==3) id=z;
     if(z==cnt1&&x==cnt2&&!vis[y]&&d[y]==3) id=y;
     if(z==cnt1&&y==cnt2&&!vis[x]&&d[x]==3) id=x;
  }
  //cout<<id<<endl;
  vis[id]=1;
  ans.push_back(id);
  dfs(id);
  int s1,s2;
  for(int i=1;i<=n;i++){
      if(d[i]==2&&!vis[i]){
        vis[i]=1;
        s1=i;
      }
      if(d[i]==1&&!vis[i]){
        vis[i]=1;
        s2=i;
      }
  }
  ans.push_back(s1);
  ans.push_back(s2);
  for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  return 0;
}
/*
6
1 3 5
2 3 5
2 4 6
4 2 3

5
1 2 3
2 5 3
4 2 5
*/


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
const double inf=1e9;
typedef long long ll;
typedef pair<ll,ll>pr;
const ll mod=998244353;
ll _pow(ll  a,ll b) {
    ll ans=1;
    while(b) {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
ll gcd(ll a,ll b){
    if(!b) return a;
    else return gcd(b,a%b);
}
vector<int>g[maxn];
int vis[maxn],d[maxn];
vector<int>ans;
void dfs(int s){
    vis[s]=1;
    for(int i=0;i<g[s].size();i++){
        int v=g[s][i];
        //cout<<s<<" "<<v<<endl;
        if(vis[v]||d[v]!=3) continue;
        ans.push_back(v);
        dfs(v);
    }
}
struct node{
    int x,y,z;
}a[maxn];
int main(){
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin>>n;
  for(int i=1;i<=n-2;i++){
     int x,y,z;
     cin>>a[i].x>>a[i].y>>a[i].z;
     d[a[i].x]++;
     d[a[i].y]++;
     d[a[i].z]++;
     g[a[i].x].push_back(a[i].y);
     g[a[i].y].push_back(a[i].x);
     g[a[i].y].push_back(a[i].z);
     g[a[i].z].push_back(a[i].y);
  }
  int id;
  for(int i=1;i<=n;i++){
      if(d[i]==1){
        id=i;
        break;
      }
  }
  vis[id]=1;
  ans.push_back(id);
  for(int i=0;i<g[id].size();i++){
      if(d[g[id][i]]==2){
         //cout<<g[id][i]<<endl;
         ans.push_back(g[id][i]);
         vis[g[id][i]]=1;
         id=g[id][i];
         break;
      }
  }

  /*for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
  */
  int cnt1=ans[0],cnt2=ans[1];
  for(int i=1;i<=n-2;i++){
     int x=a[i].x,y=a[i].y,z=a[i].z;
     if(x==cnt1&&y==cnt2) id=z;
     if(x==cnt1&&z==cnt2) id=y;
     if(y==cnt1&&z==cnt2) id=x;
     if(y==cnt1&&x==cnt2) id=z;
     if(z==cnt1&&x==cnt2) id=y;
     if(z==cnt1&&y==cnt2) id=x;
  }
  //cout<<id<<endl;
  ans.push_back(id);
  dfs(id);
  int s1,s2;
  for(int i=1;i<=n;i++){
      if(d[i]==2&&!vis[i]){
        vis[i]=1;
        s1=i;
      }
      if(d[i]==1&&!vis[i]){
        vis[i]=1;
        s2=i;
      }
  }
  ans.push_back(s1);
  ans.push_back(s2);
  for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }

  return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
const double inf=1e9;
typedef long long ll;
typedef pair<ll,ll>pr;
const ll mod=998244353;
ll _pow(ll  a,ll b) {
    ll ans=1;
    while(b) {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
ll gcd(ll a,ll b){
    if(!b) return a;
    else return gcd(b,a%b);
}
vector<int>g[maxn];
int vis[maxn],d[maxn];
vector<int>ans;
void dfs(int s){
    vis[s]=1;
    for(int i=0;i<g[s].size();i++){
        int v=g[s][i];
        //cout<<s<<" "<<v<<endl;
        if(vis[v]||d[v]!=3) continue;
        ans.push_back(v);
        dfs(v);
    }
}
struct node{
    int x,y,z;
}a[maxn];
int main(){
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin>>n;
  for(int i=1;i<=n-2;i++){
     cin>>a[i].x>>a[i].y>>a[i].z;
     d[a[i].x]++;
     d[a[i].y]++;
     d[a[i].z]++;
     g[a[i].x].push_back(a[i].y);
     g[a[i].y].push_back(a[i].x);
     g[a[i].y].push_back(a[i].z);
     g[a[i].z].push_back(a[i].y);
  }
  int id;
  for(int i=1;i<=n;i++){
      if(d[i]==1){
        id=i;
        break;
      }
  }
  /*for(int i=1;i<=n;i++){
    cout<<d[i]<<" ";
  }
  cout<<endl;
  */
  vis[id]=1;
  ans.push_back(id);
  for(int i=1;i<=n-2;i++){
     int x=a[i].x,y=a[i].y,z=a[i].z;
     if(id==x){
        if(d[y]==2) id=y;
        else if(d[z]==2) id=z;
     }
     else if(id==y){
        if(d[x]==2) id=x;
        else if(d[z]==2) id=z;
     }
     else if(id==z){
        if(d[x]==2) id=x;
        else if(d[y]==2) id=y;
     }
  }
  vis[id]=1;
  ans.push_back(id);
  /*for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
  */
  int cnt1=ans[0],cnt2=ans[1];
  for(int i=1;i<=n-2;i++){
     int x=a[i].x,y=a[i].y,z=a[i].z;
     if(x==cnt1&&y==cnt2&&!vis[z]) id=z;
     if(x==cnt1&&z==cnt2&&!vis[y]) id=y;
     if(y==cnt1&&z==cnt2&&!vis[x]) id=x;
     if(y==cnt1&&x==cnt2&&!vis[z]) id=z;
     if(z==cnt1&&x==cnt2&&!vis[y]) id=y;
     if(z==cnt1&&y==cnt2&&!vis[x]) id=x;
  }
  //cout<<id<<endl;
  ans.push_back(id);
  dfs(id);
  int s1,s2;
  for(int i=1;i<=n;i++){
      if(d[i]==2&&!vis[i]){
        vis[i]=1;
        s1=i;
      }
      if(d[i]==1&&!vis[i]){
        vis[i]=1;
        s2=i;
      }
  }
  ans.push_back(s1);
  ans.push_back(s2);
  for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  return 0;
}
/*
6
1 3 5
2 3 5
2 4 6
4 2 3
*/


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
const double inf=1e9;
typedef long long ll;
typedef pair<ll,ll>pr;
const ll mod=998244353;
ll _pow(ll  a,ll b) {
    ll ans=1;
    while(b) {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
ll gcd(ll a,ll b){
    if(!b) return a;
    else return gcd(b,a%b);
}
vector<int>g[maxn];
int vis[maxn],d[maxn];
vector<int>ans;
void dfs(int s){
    for(int i=0;i<g[s].size();i++){
        int v=g[s][i];
        if(vis[v]||d[v]!=3) continue;
        vis[v]=1;
        ans.push_back(v);
        dfs(v);
    }
}
struct node{
    int x,y,z;
}a[maxn];
int main(){
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin>>n;
  for(int i=1;i<=n-2;i++){
     cin>>a[i].x>>a[i].y>>a[i].z;
     d[a[i].x]++;
     d[a[i].y]++;
     d[a[i].z]++;
     g[a[i].x].push_back(a[i].y);
     g[a[i].y].push_back(a[i].x);
     g[a[i].y].push_back(a[i].z);
     g[a[i].z].push_back(a[i].y);
  }
  int id;
  for(int i=1;i<=n;i++){
      if(d[i]==1){
        id=i;
        break;
      }
  }
  /*for(int i=1;i<=n;i++){
    cout<<d[i]<<" ";
  }
  cout<<endl;
  */

  vis[id]=1;
  ans.push_back(id);
  //cout<<id<<endl;
  for(int i=1;i<=n-2;i++){
     int x=a[i].x;
     int y=a[i].y;
     int z=a[i].z;
     if(id==x){
        if(d[y]==2){
            id=y;
            break;
        }
        else if(d[z]==2){
            id=z;
            break;
        }
     }
     if(id==y){
        if(d[x]==2){
            id=x;
            break;
        }
        else if(d[z]==2){
            id=z;
            break;
        }
     }
     if(id==z){
        if(d[x]==2){
            id=x;
            break;
        }
        else if(d[y]==2){
            id=y;
            break;
        }

     }
  }
  vis[id]=1;
  ans.push_back(id);
  /*for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
  */
  int cnt1=ans[0],cnt2=ans[1];
  //cout<<cnt1<<" "<<cnt2<<endl;
  for(int i=1;i<=n-2;i++){
     int x=a[i].x,y=a[i].y,z=a[i].z;
     if(x==cnt1&&y==cnt2&&!vis[z]&&d[z]==3){
        id=z;
        break;
     }
     if(x==cnt1&&z==cnt2&&!vis[y]&&d[y]==3){
        id=y;
        break;
     }
     if(y==cnt1&&z==cnt2&&!vis[x]&&d[x]==3){
        id=x;
        break;
     }
     if(y==cnt1&&x==cnt2&&!vis[z]&&d[z]==3){
        id=z;
        break;
     }
     if(z==cnt1&&x==cnt2&&!vis[y]&&d[y]==3){
        id=y;id=y;
        break;
     }
     if(z==cnt1&&y==cnt2&&!vis[x]&&d[x]==3){
        id=x;
        break;
     }
  }
  //cout<<id<<endl;
  vis[id]=1;
  ans.push_back(id);
  dfs(id);
  int s1,s2;
  for(int i=1;i<=n;i++){
      if(d[i]==2&&!vis[i]){
        vis[i]=1;
        s1=i;
      }
      if(d[i]==1&&!vis[i]){
        vis[i]=1;
        s2=i;
      }
  }
  ans.push_back(s1);
  ans.push_back(s2);
  for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  return 0;
}
/*
6
1 3 5
2 3 5
2 4 6
4 2 3

5
1 2 3
2 5 3
4 2 5
*/


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
const double inf=1e9;
typedef long long ll;
typedef pair<ll,ll>pr;
const ll mod=998244353;
ll _pow(ll  a,ll b) {
    ll ans=1;
    while(b) {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
ll gcd(ll a,ll b){
    if(!b) return a;
    else return gcd(b,a%b);
}
vector<int>g[maxn];
int vis[maxn],d[maxn];
vector<int>ans;
void dfs(int s){
    vis[s]=1;
    for(int i=0;i<g[s].size();i++){
        int v=g[s][i];
        //cout<<s<<" "<<v<<endl;
        if(vis[v]||d[v]!=3) continue;
        ans.push_back(v);
        dfs(v);
    }
}
struct node{
    int x,y,z;
}a[maxn];
int main(){
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin>>n;
  for(int i=1;i<=n-2;i++){
     cin>>a[i].x>>a[i].y>>a[i].z;
     d[a[i].x]++;
     d[a[i].y]++;
     d[a[i].z]++;
     g[a[i].x].push_back(a[i].y);
     g[a[i].y].push_back(a[i].x);
     g[a[i].y].push_back(a[i].z);
     g[a[i].z].push_back(a[i].y);
  }
  int id;
  for(int i=1;i<=n;i++){
      if(d[i]==1){
        id=i;
        break;
      }
  }
  vis[id]=1;
  ans.push_back(id);
  for(int i=1;i<=n-2;i++){
     int x=a[i].x;
     int y=a[i].y;
     int z=a[i].z;
     if(id==x){
        if(d[y]==2) id=y;
        else if(d[z]==2) id=z;
     }
     else if(id==y){
        if(d[x]==2) id=x;
        else if(d[z]==2) id=z;
     }
     else if(id==z){
        if(d[x]==2) id=x;
        else if(d[y]==2) id=y;
     }
  }
  vis[id]=1;
  ans.push_back(id);
  /*for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
  */
  int cnt1=ans[0],cnt2=ans[1];
  for(int i=1;i<=n-2;i++){
     int x=a[i].x,y=a[i].y,z=a[i].z;
     if(x==cnt1&&y==cnt2&&!vis[z]) id=z;
     if(x==cnt1&&z==cnt2&&!vis[y]) id=y;
     if(y==cnt1&&z==cnt2&&!vis[x]) id=x;
     if(y==cnt1&&x==cnt2&&!vis[z]) id=z;
     if(z==cnt1&&x==cnt2&&!vis[y]) id=y;
     if(z==cnt1&&y==cnt2&&!vis[x]) id=x;
  }
  //cout<<id<<endl;
  ans.push_back(id);
  dfs(id);
  int s1,s2;
  for(int i=1;i<=n;i++){
      if(d[i]==2&&!vis[i]){
        vis[i]=1;
        s1=i;
      }
      if(d[i]==1&&!vis[i]){
        vis[i]=1;
        s2=i;
      }
  }
  ans.push_back(s1);
  ans.push_back(s2);
  for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  return 0;
}
/*
6
1 3 5
2 3 5
2 4 6
4 2 3
*/


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
const double inf=1e9;
typedef long long ll;
typedef pair<ll,ll>pr;
const ll mod=998244353;
ll _pow(ll  a,ll b) {
    ll ans=1;
    while(b) {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
ll gcd(ll a,ll b){
    if(!b) return a;
    else return gcd(b,a%b);
}
vector<int>g[maxn];
int vis[maxn],d[maxn];
vector<int>ans;
void dfs(int s){
    vis[s]=1;
    for(int i=0;i<g[s].size();i++){
        int v=g[s][i];
        //cout<<s<<" "<<v<<endl;
        if(vis[v]||d[v]!=3) continue;
        ans.push_back(v);
        dfs(v);
    }
}
struct node{
    int x,y,z;
}a[maxn];
int main(){
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin>>n;
  for(int i=1;i<=n-2;i++){
     cin>>a[i].x>>a[i].y>>a[i].z;
     d[a[i].x]++;
     d[a[i].y]++;
     d[a[i].z]++;
     g[a[i].x].push_back(a[i].y);
     g[a[i].y].push_back(a[i].x);
     g[a[i].y].push_back(a[i].z);
     g[a[i].z].push_back(a[i].y);
  }
  int id;
  for(int i=1;i<=n;i++){
      if(d[i]==1){
        id=i;
        break;
      }
  }
  vis[id]=1;
  ans.push_back(id);
  for(int i=1;i<=n-2;i++){
     int x=a[i].x;
     int y=a[i].y;
     int z=a[i].z;
     if(id==x){
        if(d[y]==2) id=y;
        else if(d[z]==2) id=z;
     }
     if(id==y){
        if(d[x]==2) id=x;
        else if(d[z]==2) id=z;
     }
     if(id==z){
        if(d[x]==2) id=x;
        else if(d[y]==2) id=y;
     }
  }
  vis[id]=1;
  ans.push_back(id);
  /*for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
  */
  int cnt1=ans[0],cnt2=ans[1];
  for(int i=1;i<=n-2;i++){
     int x=a[i].x,y=a[i].y,z=a[i].z;
     if(x==cnt1&&y==cnt2&&!vis[z]) id=z;
     if(x==cnt1&&z==cnt2&&!vis[y]) id=y;
     if(y==cnt1&&z==cnt2&&!vis[x]) id=x;
     if(y==cnt1&&x==cnt2&&!vis[z]) id=z;
     if(z==cnt1&&x==cnt2&&!vis[y]) id=y;
     if(z==cnt1&&y==cnt2&&!vis[x]) id=x;
  }
  //cout<<id<<endl;
  ans.push_back(id);
  dfs(id);
  int s1,s2;
  for(int i=1;i<=n;i++){
      if(d[i]==2&&!vis[i]){
        vis[i]=1;
        s1=i;
      }
      if(d[i]==1&&!vis[i]){
        vis[i]=1;
        s2=i;
      }
  }
  ans.push_back(s1);
  ans.push_back(s2);
  for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  return 0;
}
/*
6
1 3 5
2 3 5
2 4 6
4 2 3
*/


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
const double inf=1e9;
typedef long long ll;
typedef pair<ll,ll>pr;
const ll mod=998244353;
ll _pow(ll  a,ll b) {
    ll ans=1;
    while(b) {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
ll gcd(ll a,ll b){
    if(!b) return a;
    else return gcd(b,a%b);
}
vector<int>g[maxn];
int vis[maxn],d[maxn];
vector<int>ans;
void dfs(int s){
    vis[s]=1;
    for(int i=0;i<g[s].size();i++){
        int v=g[s][i];
        //cout<<s<<" "<<v<<endl;
        if(vis[v]||d[v]!=3) continue;
        ans.push_back(v);
        dfs(v);
    }
}
struct node{
    int x,y,z;
}a[maxn];
int main(){
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin>>n;
  for(int i=1;i<=n-2;i++){
     cin>>a[i].x>>a[i].y>>a[i].z;
     d[a[i].x]++;
     d[a[i].y]++;
     d[a[i].z]++;
     g[a[i].x].push_back(a[i].y);
     g[a[i].y].push_back(a[i].x);
     g[a[i].y].push_back(a[i].z);
     g[a[i].z].push_back(a[i].y);
  }
  int id;
  for(int i=1;i<=n;i++){
      if(d[i]==1){
        id=i;
        break;
      }
  }
  vis[id]=1;
  ans.push_back(id);
  for(int i=1;i<=n-2;i++){
     int x=a[i].x;
     int y=a[i].y;
     int z=a[i].z;
     if(id==x){
        if(d[y]==2) id=y;
        if(d[z]==2) id=z;
     }
     if(id==y){
        if(d[x]==2) id=x;
        if(d[z]==2) id=z;
     }
     if(id==z){
        if(d[x]==2) id=x;
        if(d[y]==2) id=y;
     }
  }
  vis[id]=1;
  ans.push_back(id);
  /*for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
  */
  int cnt1=ans[0],cnt2=ans[1];
  for(int i=1;i<=n-2;i++){
     int x=a[i].x,y=a[i].y,z=a[i].z;
     if(x==cnt1&&y==cnt2&&!vis[z]&&d[z]==3) id=z;
     if(x==cnt1&&z==cnt2&&!vis[y]&&d[y]==3) id=y;
     if(y==cnt1&&z==cnt2&&!vis[x]&&d[x]==3) id=x;
     if(y==cnt1&&x==cnt2&&!vis[z]&&d[z]==3) id=z;
     if(z==cnt1&&x==cnt2&&!vis[y]&&d[y]==3) id=y;
     if(z==cnt1&&y==cnt2&&!vis[x]&&d[x]==3) id=x;
  }
  //cout<<id<<endl;
  ans.push_back(id);
  dfs(id);
  int s1,s2;
  for(int i=1;i<=n;i++){
      if(d[i]==2&&!vis[i]){
        vis[i]=1;
        s1=i;
      }
      if(d[i]==1&&!vis[i]){
        vis[i]=1;
        s2=i;
      }
  }
  ans.push_back(s1);
  ans.push_back(s2);
  for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  return 0;
}
/*
6
1 3 5
2 3 5
2 4 6
4 2 3
*/


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
const double inf=1e9;
typedef long long ll;
typedef pair<ll,ll>pr;
const ll mod=998244353;
ll _pow(ll  a,ll b) {
    ll ans=1;
    while(b) {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
ll gcd(ll a,ll b){
    if(!b) return a;
    else return gcd(b,a%b);
}
vector<int>g[maxn];
int vis[maxn],d[maxn];
vector<int>ans;
void dfs(int s){
    for(int i=0;i<g[s].size();i++){
        int v=g[s][i];
        if(vis[v]||d[v]!=3) continue;
        vis[v]=1;
        ans.push_back(v);
        dfs(v);
    }
}
struct node{
    int x,y,z;
}a[maxn];
int main(){
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin>>n;
  for(int i=1;i<=n-2;i++){
     cin>>a[i].x>>a[i].y>>a[i].z;
     d[a[i].x]++;
     d[a[i].y]++;
     d[a[i].z]++;
     g[a[i].x].push_back(a[i].y);
     g[a[i].y].push_back(a[i].x);
     g[a[i].y].push_back(a[i].z);
     g[a[i].z].push_back(a[i].y);
  }
  int id;
  for(int i=1;i<=n;i++){
      if(d[i]==1){
        id=i;
        break;
      }
  }
  /*for(int i=1;i<=n;i++){
    cout<<d[i]<<" ";
  }
  cout<<endl;
  */

  vis[id]=1;
  ans.push_back(id);
  //cout<<id<<endl;
  for(int i=1;i<=n-2;i++){
     int x=a[i].x;
     int y=a[i].y;
     int z=a[i].z;
     if(id==x){
        if(d[y]==2){
            id=y;
            break;
        }
        else if(d[z]==2){
            id=z;
            break;
        }
     }
     else if(id==y){
        if(d[x]==2){
            id=x;
            break;
        }
        else if(d[z]==2){
            id=z;
            break;
        }
     }
     else if(id==z){
        if(d[x]==2){
            id=x;
            break;
        }
        else if(d[y]==2){
            id=y;
            break;
        }

     }
  }
  vis[id]=1;
  ans.push_back(id);
  /*for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
  */
  int cnt1=ans[0],cnt2=ans[1];
  //cout<<cnt1<<" "<<cnt2<<endl;
  for(int i=1;i<=n-2;i++){
     int x=a[i].x,y=a[i].y,z=a[i].z;
     if(x==cnt1&&y==cnt2&&!vis[z]&&d[z]==3){
        id=z;
        break;
     }
     if(x==cnt1&&z==cnt2&&!vis[y]&&d[y]==3){
        id=y;
        break;
     }
     if(y==cnt1&&z==cnt2&&!vis[x]&&d[x]==3){
        id=x;
        break;
     }
     if(y==cnt1&&x==cnt2&&!vis[z]&&d[z]==3){
        id=z;
        break;
     }
     if(z==cnt1&&x==cnt2&&!vis[y]&&d[y]==3){
        id=y;id=y;
        break;
     }
     if(z==cnt1&&y==cnt2&&!vis[x]&&d[x]==3){
        id=x;
        break;
     }
  }
  //cout<<id<<endl;
  vis[id]=1;
  ans.push_back(id);
  dfs(id);
  int s1,s2;
  for(int i=1;i<=n;i++){
      if(d[i]==2&&!vis[i]){
        vis[i]=1;
        s1=i;
      }
      if(d[i]==1&&!vis[i]){
        vis[i]=1;
        s2=i;
      }
  }
  ans.push_back(s1);
  ans.push_back(s2);
  for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  return 0;
}
/*
6
1 3 5
2 3 5
2 4 6
4 2 3

5
1 2 3
2 5 3
4 2 5
*/


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
const double inf=1e9;
typedef long long ll;
typedef pair<ll,ll>pr;
const ll mod=998244353;
ll _pow(ll  a,ll b) {
    ll ans=1;
    while(b) {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
ll gcd(ll a,ll b){
    if(!b) return a;
    else return gcd(b,a%b);
}
vector<int>g[maxn];
int vis[maxn],d[maxn];
vector<int>ans;
void dfs(int s){
    vis[s]=1;
    for(int i=0;i<g[s].size();i++){
        int v=g[s][i];
        //cout<<s<<" "<<v<<endl;
        if(vis[v]||d[v]!=3) continue;
        ans.push_back(v);
        dfs(v);
    }
}
struct node{
    int x,y,z;
}a[maxn];
int main(){
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin>>n;
  for(int i=1;i<=n-2;i++){
     cin>>a[i].x>>a[i].y>>a[i].z;
     d[a[i].x]++;
     d[a[i].y]++;
     d[a[i].z]++;
     g[a[i].x].push_back(a[i].y);
     g[a[i].y].push_back(a[i].x);
     g[a[i].y].push_back(a[i].z);
     g[a[i].z].push_back(a[i].y);
  }
  int id;
  for(int i=1;i<=n;i++){
      if(d[i]==1){
        id=i;
        break;
      }
  }
  vis[id]=1;
  ans.push_back(id);
  for(int i=1;i<=n-2;i++){
     int x=a[i].x;
     int y=a[i].y;
     int z=a[i].z;
     if(id==x){
        if(d[y]==2) id=y;
        if(d[z]==2) id=z;
     }
     if(id==y){
        if(d[x]==2) id=x;
        if(d[z]==2) id=z;
     }
     if(id==z){
        if(d[x]==2) id=x;
        if(d[y]==2) id=y;
     }
  }
  vis[id]=1;
  ans.push_back(id);
  /*for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  cout<<endl;
  */
  int cnt1=ans[0],cnt2=ans[1];
  for(int i=1;i<=n-2;i++){
     int x=a[i].x,y=a[i].y,z=a[i].z;
     if(x==cnt1&&y==cnt2&&!vis[z]) id=z;
     if(x==cnt1&&z==cnt2&&!vis[y]) id=y;
     if(y==cnt1&&z==cnt2&&!vis[x]) id=x;
     if(y==cnt1&&x==cnt2&&!vis[z]) id=z;
     if(z==cnt1&&x==cnt2&&!vis[y]) id=y;
     if(z==cnt1&&y==cnt2&&!vis[x]) id=x;
  }
  //cout<<id<<endl;
  ans.push_back(id);
  dfs(id);
  int s1,s2;
  for(int i=1;i<=n;i++){
      if(d[i]==2&&!vis[i]){
        vis[i]=1;
        s1=i;
      }
      if(d[i]==1&&!vis[i]){
        vis[i]=1;
        s2=i;
      }
  }
  ans.push_back(s1);
  ans.push_back(s2);
  for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
  return 0;
}
/*
6
1 3 5
2 3 5
2 4 6
4 2 3
*/


#include <bits/stdc++.h>
const int MAXN = 1e5 +5;
using namespace std;
int cnt[MAXN];
int a[3][MAXN];

int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for(int k = 0; k < 3; k++){
        for(int i = 0; i < n - 2; i++){
            cin >> a[k][i];
            cnt[a[k][i]]++;
        }
    }
    vector<int> c1, c2;
    for(int i = 1; i <= n; i++){
        if(cnt[i] == 1){
            c1.push_back(i);
        }
        else if(cnt[i] == 2){
            c2.push_back(i);
        }
    }
    int pos = 0;
    bool flag = false;
    for(int k = 0; k < 3; k++){
        for(int i = 0; i < n - 2; i++){
            if(a[k][i] == c1[0]){
                pos = k;
                flag = true;
                break;
            }
        }
        if(flag) break;
    }
    for(int i = 0; i < n - 2; i++){
        if(a[pos][i] == c2[0]){
            flag = true;
            break;
        }
    }
    if(flag) swap(c2[0], c2[1]);
    cout << c1[0] << " " << c2[0] << " ";
    for(int i = 1; i <= n; i++){
        if(cnt[i] == 3){
            cout << i << " ";
        }
    }
    cout << c2[1] << " " << c1[1] << " ";
}

/*

5
4 3 2
2 3 5
4 1 2

*/


#include <bits/stdc++.h>
const int MAXN = 1e5 +5;
using namespace std;
int a[3][MAXN], cnt[MAXN];
bool vis[MAXN];
vector<int> ve[MAXN];

int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for(int i = 0; i < n - 2; i++){
        for(int j = 0; j < 3; j++){
            cin >> a[i][j];
            ve[a[i][j]].push_back(i);
            cnt[a[i][j]]++;
        }
    }
    int c1, c2, pos;
    for(int i = 1; i <= n; i++){
        if(cnt[i] == 1){
            c1 = i;
            pos = ve[i][0];
            break;
        }
    }
    for(int i = 1; i <= n; i++){
        if(cnt[i] == 2){
            if(pos == ve[i][0] || pos == ve[i][1]){
                c2 = i;
                break;
            }
        }
    }
    cout << c1 << " " << c2 << " ";
    while(1){
        bool flag = false;
        for(int k = 0; k < ve[c2].size(); k++){
            pos = ve[c2][k];
            if(vis[pos]) continue;
            int cnt = 0;
            for(int i = 0; i < 3; i++){
                if(a[pos][i] == c1 || a[pos][i] == c2){
                    cnt++;
                }
            }
            if(cnt != 2) continue;
            vis[pos] = true;
            for(int i = 0; i < 3; i++){
                if(a[pos][i] == c1 || a[pos][i] == c2){
                    continue;
                }
                cout << a[pos][i] << " ";
                c1 = c2;
                c2 = a[pos][i];
                flag = true;
                break;
            }
        }
        if(!flag) break;
    }
}

/*

5
4 3 2
2 3 5
4 1 2

1 4 2 3 5

5
4 5 3
2 5 1
1 3 5

2 1 5 3 4

6
1 6 5
4 5 1
2 4 1
4 2 3

3 2 4 1 5 6

*/


#include <bits/stdc++.h>
const int MAXN = 1e5 +5;
using namespace std;
int cnt[MAXN];

int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for(int k = 0; k < 3; k++){
        for(int i = 0; i < n - 2; i++){
            int x;
            cin >> x;
            cnt[x]++;
        }
    }
    vector<int> c1, c2;
    for(int i = 1; i <= n; i++){
        if(cnt[i] == 1){
            c1.push_back(i);
        }
        else if(cnt[i] == 2){
            c2.push_back(i);
        }
    }
    cout << c1[0] << " " << c2[0] << " ";
    for(int i = 1; i <= n; i++){
        if(cnt[i] == 3){
            cout << i << " ";
        }
    }
    cout << c2[1] << " " << c1[1] << " ";
}

/*

5
4 3 2
2 3 5
4 1 2

*/


#include <bits/stdc++.h>
const int MAXN = 1e5 +5;
using namespace std;
int cnt[MAXN];
int a[3][MAXN];

int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for(int k = 0; k < 3; k++){
        for(int i = 0; i < n - 2; i++){
            cin >> a[k][i];
            cnt[a[k][i]]++;
        }
    }
    vector<int> c1, c2;
    for(int i = 1; i <= n; i++){
        if(cnt[i] == 1){
            c1.push_back(i);
        }
        else if(cnt[i] == 2){
            c2.push_back(i);
        }
    }
    int pos = 0;
    bool flag = false;
    for(int k = 0; k < 3; k++){
        for(int i = 0; i < n - 2; i++){
            if(a[k][i] == c1[0]){
                pos = k;
                flag = true;
                break;
            }
        }
        if(flag) break;
    }
    for(int i = 0; i < n - 2; i++){
        if(a[pos][i] == c2[0]){
            flag = false;
            break;
        }
    }
    if(flag) swap(c2[0], c2[1]);
    cout << c1[0] << " " << c2[0] << " ";
    for(int i = 1; i <= n; i++){
        if(cnt[i] == 3){
            cout << i << " ";
        }
    }
    cout << c2[1] << " " << c1[1] << " ";
}

/*

5
4 3 2
2 3 5
4 1 2

1 4 2 3 5

5
4 5 3
2 5 1
1 3 5

2 1 5 3 4

*/


#include <bits/stdc++.h>
const int MAXN = 1e5 +5;
using namespace std;
int a[MAXN][3], cnt[MAXN];
bool vis[MAXN];
vector<int> ve[MAXN];

int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for(int i = 0; i < n - 2; i++){
        for(int j = 0; j < 3; j++){
            cin >> a[i][j];
            ve[a[i][j]].push_back(i);
            cnt[a[i][j]]++;
        }
    }
    int c1, c2, pos;
    for(int i = 1; i <= n; i++){
        if(cnt[i] == 1){
            c1 = i;
            pos = ve[i][0];
            break;
        }
    }
    for(int i = 1; i <= n; i++){
        if(cnt[i] == 2){
            if(pos == ve[i][0] || pos == ve[i][1]){
                c2 = i;
                break;
            }
        }
    }
    cout << c1 << " " << c2 << " ";
    while(1){
        bool flag = false;
        for(int k = 0; k < ve[c2].size(); k++){
            pos = ve[c2][k];
            if(vis[pos]) continue;
            int cnt = 0;
            for(int i = 0; i < 3; i++){
                if(a[pos][i] == c1 || a[pos][i] == c2){
                    cnt++;
                }
            }
            if(cnt != 2) continue;
            vis[pos] = true;
            for(int i = 0; i < 3; i++){
                if(a[pos][i] == c1 || a[pos][i] == c2){
                    continue;
                }
                cout << a[pos][i] << " ";
                c1 = c2;
                c2 = a[pos][i];
                flag = true;
                break;
            }
        }
        if(!flag) break;
    }
}

/*

5
4 3 2
2 3 5
4 1 2

1 4 2 3 5

5
4 5 3
2 5 1
1 3 5

2 1 5 3 4

6
1 6 5
4 5 1
2 4 1
4 2 3

3 2 4 1 5 6

*/


#include <bits/stdc++.h>

using namespace std;
#define F first
#define S second
int n,a,b,c;
vector<int>adj[100005];
int ctr[100005];
bool vis[100005];

int main()
{
    cin>>n;
    for(int i=0; i<n-2; i++)
    {
        cin>>a>>b>>c;
        adj[a].push_back(b);
        adj[a].push_back(c);
        adj[b].push_back(a);
        adj[b].push_back(c);
        adj[c].push_back(a);
        adj[c].push_back(b);
        ctr[a]++;
        ctr[b]++;
        ctr[c]++;
    }
    int strt;
    for(int i=1; i<=n; i++)
    {
        if(ctr[i]==1)
        {
            strt=i;
            break;
        }
    }
    vector<int>ans;
    ans.push_back(strt);
    if(ctr[adj[strt][0]]>ctr[adj[strt][1]])
    {
        ans.push_back(adj[strt][1]);
        ans.push_back(adj[strt][0]);
    }
    else
    {
        ans.push_back(adj[strt][0]);
        ans.push_back(adj[strt][1]);
    }
    vis[strt]=true;
    vis[ans[1]]=true;
    vis[ans[2]]=true;
    int ind=2;
    int fi,se;
    if(n%2==1)
    {
        fi=(n/2)-1;
        se=-1;
    }
    else
    {
        fi=(n/2)-2;
        se=fi-1;
    }
    //cout<<fi<<' '<<se<<endl;
    while(ans.size()<n)
    {
        int mn=10000,lol;
        if(ind>=fi||(ind>=se&&se!=-1))
        {
            mn=-1;
            for(int i:adj[ans[ind]])
            {
                //cout<<i<<' '<<ctr[i]<<endl;
                if(ctr[i]>mn&&!vis[i])
                {
                    mn=ctr[i];
                    lol=i;
                }
            }
        }
        else
        {
            for(int i:adj[ans[ind]])
            {
                if(ctr[i]<mn&&!vis[i])
                {
                    mn=ctr[i];
                    lol=i;
                }
            }
        }
        ans.push_back(lol);
        vis[lol]=true;
        ind++;
    }
    for(int i=0; i<ans.size(); i++)
        cout<<ans[i]<<' ';
}


#include <bits/stdc++.h>

using namespace std;
#define F first
#define S second
int n,a,b,c;
vector<int>adj[100005];
int ctr[100005];
bool vis[100005];

int main()
{
    cin>>n;
    for(int i=0; i<n-2; i++)
    {
        cin>>a>>b>>c;
        adj[a].push_back(b);
        adj[a].push_back(c);
        adj[b].push_back(a);
        adj[b].push_back(c);
        adj[c].push_back(a);
        adj[c].push_back(b);
        ctr[a]++;
        ctr[b]++;
        ctr[c]++;
    }
    int strt;
    for(int i=1; i<=n; i++)
    {
        if(ctr[i]==1)
        {
            strt=i;
            break;
        }
    }
    vector<int>ans;
    ans.push_back(strt);
    if(ctr[adj[strt][0]]>ctr[adj[strt][1]])
    {
        ans.push_back(adj[strt][1]);
        ans.push_back(adj[strt][0]);
    }
    else
    {
        ans.push_back(adj[strt][0]);
        ans.push_back(adj[strt][1]);
    }
    vis[strt]=true;
    vis[ans[1]]=true;
    vis[ans[2]]=true;
    int ind=2;
    int fi,se;
    if(n%2==1)
    {
        fi=(n/2)-1;
        se=-1;
    }
    else
    {
        fi=(n/2)-2;
        se=fi-1;
    }
    //cout<<fi<<' '<<se<<endl;
    while(ans.size()<n)
    {
        int mn=10000,lol;
        vector<pair<int,int>>tmp;
        if(ind>=fi||(ind>=se&&se!=-1))
        {
            mn=-1;
            for(int i:adj[ans[ind]])
            {
                if(!vis[i])
                {
                    tmp.push_back(make_pair(ctr[i],i));
                    vis[i]=true;
                }
            }
            sort(tmp.rbegin(),tmp.rend());
            for(int aa=0;aa<tmp.size();aa++)
                ans.push_back(tmp[aa].second);
        }
        else
        {
            for(int i:adj[ans[ind]])
            {
                if(!vis[i])
                {
                    tmp.push_back(make_pair(ctr[i],i));
                    vis[i]=true;
                }
            }
            sort(tmp.begin(),tmp.end());
            for(int aa=0;aa<tmp.size();aa++)
                ans.push_back(tmp[aa].second);
        }
        int dadadada=tmp.size();
        ind+=dadadada;
    }
    for(int i=0; i<ans.size(); i++)
        cout<<ans[i]<<' ';
}


#include <bits/stdc++.h>

using namespace std;
#define F first
#define S second
int n,a,b,c;
vector<int>adj[100005];
int ctr[100005];
bool vis[100005];

int main()
{
    cin>>n;
    for(int i=0; i<n-2; i++)
    {
        cin>>a>>b>>c;
        adj[a].push_back(b);
        adj[a].push_back(c);
        adj[b].push_back(a);
        adj[b].push_back(c);
        adj[c].push_back(a);
        adj[c].push_back(b);
        ctr[a]++;
        ctr[b]++;
        ctr[c]++;
    }
    int strt;
    for(int i=1; i<=n; i++)
    {
        if(ctr[i]==1)
        {
            strt=i;
            break;
        }
    }
    vector<int>ans;
    ans.push_back(strt);
    if(ctr[adj[strt][0]]>ctr[adj[strt][1]])
    {
        ans.push_back(adj[strt][1]);
        ans.push_back(adj[strt][0]);
    }
    else
    {
        ans.push_back(adj[strt][0]);
        ans.push_back(adj[strt][1]);
    }
    vis[strt]=true;
    vis[ans[1]]=true;
    vis[ans[2]]=true;
    int ind=2;
    int fi,se;
    if(n%2==1)
    {
        fi=(n/2)-1;
        se=-1;
    }
    else
    {
        fi=(n/2)-2;
        se=fi-1;
    }
    //cout<<fi<<' '<<se<<endl;
    while(ans.size()<n)
    {
        int mn=10000,lol;
        vector<pair<int,int>>tmp;
        if(ind>=fi||(ind>=se&&se!=-1))
        {
            mn=-1;
            for(int i:adj[ans[ind]])
            {
                if(!vis[i])
                {
                    tmp.push_back(make_pair(ctr[i],i));
                    vis[i]=true;
                }
            }
            sort(tmp.rbegin(),tmp.rend());
            for(int aa=0;aa<tmp.size();aa++)
                ans.push_back(tmp[aa].second);
        }
        else
        {
            for(int i:adj[ans[ind]])
            {
                if(!vis[i])
                {
                    tmp.push_back(make_pair(ctr[i],i));
                    vis[i]=true;
                }
            }
            sort(tmp.begin(),tmp.end());
            for(int aa=0;aa<tmp.size();aa++)
                ans.push_back(tmp[aa].second);
        }
        ind+=1;
    }
    for(int i=0; i<ans.size(); i++)
        cout<<ans[i]<<' ';
}


#include <bits/stdc++.h>

using namespace std;
#define F first
#define S second
int n,a,b,c;
vector<int>adj[100005];
int ctr[100005];
bool vis[100005];

int main()
{
    cin>>n;
    for(int i=0; i<n-2; i++)
    {
        cin>>a>>b>>c;
        adj[a].push_back(b);
        adj[a].push_back(c);
        adj[b].push_back(a);
        adj[b].push_back(c);
        adj[c].push_back(a);
        adj[c].push_back(b);
        ctr[a]++;
        ctr[b]++;
        ctr[c]++;
    }
    int strt;
    for(int i=1; i<=n; i++)
    {
        if(ctr[i]==1)
        {
            strt=i;
            break;
        }
    }
    vector<int>ans;
    ans.push_back(strt);
    if(ctr[adj[strt][0]]>ctr[adj[strt][1]])
    {
        ans.push_back(adj[strt][1]);
        ans.push_back(adj[strt][0]);
    }
    else
    {
        ans.push_back(adj[strt][0]);
        ans.push_back(adj[strt][1]);
    }
    vis[strt]=true;
    vis[ans[1]]=true;
    vis[ans[2]]=true;
    int ind=1;
    int fi,se;
    if(n%2==1)
    {
        fi=(n/2)-1;
        se=-1;
    }
    else
    {
        fi=(n/2)-2;
        se=fi-1;
    }
    //cout<<fi<<' '<<se<<endl;
    while(ans.size()<n)
    {
        int mn=10000,lol;
        vector<pair<int,int>>tmp;
        if(ind>=fi||(ind>=se&&se!=-1))
        {
            mn=-1;
            for(int i:adj[ans[ind]])
            {
                if(!vis[i])
                {
                    tmp.push_back(make_pair(ctr[i],i));
                    vis[i]=true;
                }
            }
            sort(tmp.rbegin(),tmp.rend());
            for(int aa=0;aa<tmp.size();aa++)
                ans.push_back(tmp[aa].second);
        }
        else
        {
            for(int i:adj[ans[ind]])
            {
                if(!vis[i])
                {
                    tmp.push_back(make_pair(ctr[i],i));
                    vis[i]=true;
                }
            }
            sort(tmp.begin(),tmp.end());
            for(int aa=0;aa<tmp.size();aa++)
                ans.push_back(tmp[aa].second);
        }
        ind+=1;
    }
    for(int i=0; i<ans.size(); i++)
        cout<<ans[i]<<' ';
}


#include <bits/stdc++.h>

using namespace std;
#define F first
#define S second
int n,a,b,c;
vector<int>adj[100005];
int ctr[100005];
bool vis[100005];

int main()
{
    cin>>n;
    for(int i=0; i<n-2; i++)
    {
        cin>>a>>b>>c;
        adj[a].push_back(b);
        adj[a].push_back(c);
        adj[b].push_back(a);
        adj[b].push_back(c);
        adj[c].push_back(a);
        adj[c].push_back(b);
        ctr[a]++;
        ctr[b]++;
        ctr[c]++;
    }
    int strt;
    for(int i=1; i<=n; i++)
    {
        if(ctr[i]==1)
        {
            strt=i;
            break;
        }
    }
    vector<int>ans;
    ans.push_back(strt);
    if(ctr[adj[strt][0]]>ctr[adj[strt][1]])
    {
        ans.push_back(adj[strt][1]);
        ans.push_back(adj[strt][0]);
    }
    else
    {
        ans.push_back(adj[strt][0]);
        ans.push_back(adj[strt][1]);
    }
    vis[strt]=true;
    vis[ans[1]]=true;
    vis[ans[2]]=true;
    int ind=2;
    int fi,se;
    if(n%2==1)
    {
        fi=(n/2)-1;
        se=-1;
    }
    else
    {
        fi=(n/2)-2;
        se=fi-1;
    }
    //cout<<fi<<' '<<se<<endl;
    while(ans.size()<n)
    {
        int mn=10000,lol;
        vector<pair<int,int>>tmp;
        if(ind>=fi||(ind>=se&&se!=-1))
        {
            mn=-1;
            for(int i:adj[ans[ind]])
            {
                if(!vis[i])
                {
                    tmp.push_back(make_pair(ctr[i],i));
                    vis[i]=true;
                }
            }
            sort(tmp.rbegin(),tmp.rend());
            ans.push_back(tmp[0].second);
            ans.push_back(tmp[1].second);
        }
        else
        {
            for(int i:adj[ans[ind]])
            {
                if(!vis[i])
                {
                    tmp.push_back(make_pair(ctr[i],i));
                    vis[i]=true;
                }
            }
            sort(tmp.begin(),tmp.end());
            ans.push_back(tmp[0].second);
            ans.push_back(tmp[1].second);
        }
        ind+=2;
    }
    for(int i=0; i<ans.size(); i++)
        cout<<ans[i]<<' ';
}


#include <bits/stdc++.h>

using namespace std;
#define F first
#define S second
int n,a,b,c;
vector<int>adj[100005];
int ctr[100005];
bool vis[100005];

int main()
{
    cin>>n;
    for(int i=0; i<n-2; i++)
    {
        cin>>a>>b>>c;
        adj[a].push_back(b);
        adj[a].push_back(c);
        adj[b].push_back(a);
        adj[b].push_back(c);
        adj[c].push_back(a);
        adj[c].push_back(b);
        ctr[a]++;
        ctr[b]++;
        ctr[c]++;
    }
    int strt;
    for(int i=1; i<=n; i++)
    {
        if(ctr[i]==1)
        {
            strt=i;
            break;
        }
    }
    vector<int>ans;
    ans.push_back(strt);
    vis[strt]=true;
    int ind=0;
    int fi,se;
    if(n%2==1)
    {
        fi=(n/2)-1;
        se=-1;
    }
    else
    {
        fi=(n/2)-2;
        se=fi-1;
    }
    //cout<<fi<<' '<<se<<endl;
    while(ans.size()<n)
    {
        int mn=10000,lol;
        if(ind>=fi||(ind>=se&&se!=-1))
        {
            mn=-1;
            for(int i:adj[ans[ind]])
            {
                //cout<<i<<' '<<ctr[i]<<endl;
                if(ctr[i]>mn&&!vis[i])
                {
                    mn=ctr[i];
                    lol=i;
                }
            }
        }
        else
        {
            for(int i:adj[ans[ind]])
            {
                if(ctr[i]<mn&&!vis[i])
                {
                    mn=ctr[i];
                    lol=i;
                }
            }
        }
        ans.push_back(lol);
        vis[lol]=true;
        ind++;
    }
    for(int i=0; i<ans.size(); i++)
        cout<<ans[i]<<' ';
}


#include <bits/stdc++.h>

using namespace std;
#define F first
#define S second
int n,a,b,c;
vector<int>adj[100005];
int ctr[100005];
bool vis[100005];

int main()
{
    cin>>n;
    for(int i=0; i<n-2; i++)
    {
        cin>>a>>b>>c;
        adj[a].push_back(b);
        adj[a].push_back(c);
        adj[b].push_back(a);
        adj[b].push_back(c);
        adj[c].push_back(a);
        adj[c].push_back(b);
        ctr[a]++;
        ctr[b]++;
        ctr[c]++;
    }
    int strt;
    for(int i=1; i<=n; i++)
    {
        if(ctr[i]==1)
        {
            strt=i;
            break;
        }
    }
    vector<int>ans;
    ans.push_back(strt);
    if(ctr[adj[strt][0]]>ctr[adj[strt][1]])
    {
        ans.push_back(adj[strt][1]);
        ans.push_back(adj[strt][0]);
    }
    else
    {
        ans.push_back(adj[strt][0]);
        ans.push_back(adj[strt][1]);
    }
    vis[strt]=true;
    vis[ans[1]]=true;
    vis[ans[2]]=true;
    int ind=2;
    int fi,se;
    if(n%2==1)
    {
        fi=(n/2)-1;
        se=-1;
    }
    else
    {
        fi=(n/2)-2;
        se=fi-1;
    }
    //cout<<fi<<' '<<se<<endl;
    while(ans.size()<n)
    {
        int mn=10000,lol;
        vector<pair<int,int>>tmp;
        if(ind>=fi||(ind>=se&&se!=-1))
        {
            mn=-1;
            for(int i:adj[ans[ind]])
            {
                if(!vis[i])
                {
                    tmp.push_back(make_pair(ctr[i],i));
                    vis[i]=true;
                }
            }
            sort(tmp.rbegin(),tmp.rend());
            for(int aa=0;aa<tmp.size();aa++)
                ans.push_back(tmp[aa].second);
        }
        else
        {
            for(int i:adj[ans[ind]])
            {
                if(!vis[i])
                {
                    tmp.push_back(make_pair(ctr[i],i));
                    vis[i]=true;
                }
            }
            sort(tmp.begin(),tmp.end());
            for(int aa=0;aa<tmp.size();aa++)
                ans.push_back(tmp[aa].second);
        }
        ind+=2;
    }
    for(int i=0; i<ans.size(); i++)
        cout<<ans[i]<<' ';
}


#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))
#define ll long long int
#define pb push_back
#define INF LONG_LONG_MAX
#define mod 998244353
#define mp make_pair
#define inf 1e18+5
#define ff first
#define ss second
const int N = 1e5 + 10;
bool pri[1000001];
ll c[1001][1001];
/*void binomialCoeff()
{
    //ll C[n + 1][k + 1];
    ll i, j;
    for (i = 0; i <= 1000; i++)
    {
        for (j = 0; j <= min(i, 1000); j++)
        {
            if (j == 0 || j == i)
                C[i][j] = 1;
            else
                C[i][j] = C[i - 1][j - 1] +
                          C[i - 1][j];
        }
    }
    //return C[n][k];
}*/
void sieve()
{
    ll i,j;
    for(i=2;i*i<=1000000;i++)
    {
        if(pri[i])
        {
            for(j=i*i;j<=1000000;j+=i)
                pri[j]=0;
        }
    }
}
ll po(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
ll GCD(ll A, ll B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
int main()
{
    FAST;
    ll n,i,j;
    cin>>n;
    ll co[n+1]={0};
    map<ll,pair<ll,ll>> m;
    map<pair<ll,ll>,ll> m1;
    for(i=0;i<n-2;i++)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        co[a]++;
        co[b]++;
        co[c]++;
        //cout<<co[1]<<endl;
        m[a]={b,c};
        m[b]={a,c};
        m[c]={a,b};
        if(a<b)
            m1[{a,b}]=c;
        else
            m1[{b,a}]=c;
        if(c<b)
            m1[{c,b}]=a;
        else
            m1[{b,c}]=a;
        if(a<c)
            m1[{a,c}]=b;
        else
            m1[{c,a}]=b;
    }
    vector<ll> v;
    for(i=1;i<=n;i++)
    {
        if(co[i]==1)
            v.pb(i);
    }
    vector<ll> ans(n);
    //cout<<co[1]<<endl;
    //cout<<v[0]<<" "<<v[1]<<endl;
    ans[0]=v[0];
    //cout<<co[m[v[0]].ff]<<" "<<co[m[v[0]].ss]<<endl;
    if(co[m[v[0]].ff]==2)
        ans[1]=m[v[0]].ff;
    else
        ans[1]=m[v[0]].ss;
    ans[n-1]=v[1];
    if(co[m[v[1]].ff]==2)
        ans[n-2]=m[v[1]].ff;
    else
        ans[n-2]=m[v[1]].ss;
    //for(i=0;i<n;i++)
      //  cout<<ans[i]<<" ";
    j=2;
    for(i=0;i<n-4;i++)
    {
        //cout<<"HI"<<endl;
        ll a,b;
        a=ans[j-1];
        b=ans[j-2];
        if(a>b)
            swap(a,b);
        ans[j]=m1[{a,b}];
        //cout<<m1[{1,2}]<<endl;
        j++;
    }
    for(i=0;i<n;i++)
        cout<<ans[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))
#define ll long long int
#define pb push_back
#define INF LONG_LONG_MAX
#define mod 1000000007
#define mp make_pair
#define ff first
#define ss second
const int N = 1e5 + 10;
bool pri[1000001];
void sieve()
{
    ll i,j;
    for(i=2;i*i<=1000000;i++)
    {
        if(pri[i])
        {
            for(j=i*i;j<=1000000;j+=i)
                pri[j]=0;
        }
    }
}
ll po(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
ll GCD(ll A, ll B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
int main()
{
    FAST;
    ll n,i,j,k;
    cin>>n;
    ll co[n+1]={0};
    bool vis[n+1]={0};
    map<pair<ll,ll>,vector<ll>> m;
    ll s1,s2;
    for(i=0;i<n-2;i++)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        if(a==1)
        {
            s1=b;
            s2=c;
        }
        else if(b==1)
        {
            s1=a;
            s2=c;
        }
        else
        {
            s1=a;
            s2=b;
        }
        co[a]++;
        co[b]++;
        co[c]++;
        m[{a,b}].pb(c);
        m[{b,a}].pb(c);
        m[{b,c}].pb(a);
        m[{c,b}].pb(a);
        m[{a,c}].pb(b);
        m[{c,a}].pb(b);
    }
    ll s,ls;
    if(co[s2]==2)
        s1=s2;
    for(i=2;i<=n-1;i++)
    {
        if(co[i]==2)
        {
            s=i;
            break;
        }
    }
    i++;
    for(;i<=n-1;i++)
    {
        if(co[i]==2)
        {
            ls=i;
            break;
        }
    }
    if(s!=s1)
        swap(s,ls);
    //cout<<s<<" "<<ls<<endl;
    ll ans[n];
    ans[0]=1;
    ans[1]=s;
    ans[n-2]=ls;
    ans[n-1]=n;
    vis[1]=vis[n]=vis[s]=vis[ls]=1;
    //cout<<m[{1,4}][0]<<" "<<m[{1,4}][1]<<endl;
    for(i=2;i<n-2;i++)
    {
        vector<ll> t=m[{ans[i-1],ans[i-2]}];
        //cout<<t[0]<<" "<<t[1]<<endl;
        //cout<<vis[t[0]]<<endl;
        if(vis[t[0]]==0)
        {
            ans[i]=t[0];
            vis[t[0]]=1;
        }
        else if(vis[t[1]]==0)
        {
            ans[i]=t[1];
            vis[t[1]]=1;
        }
    }
    for(i=0;i<n;i++)
        cout<<ans[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))
#define ll long long int
#define pb push_back
#define INF LONG_LONG_MAX
#define mod 998244353
#define mp make_pair
#define inf 1e18+5
#define ff first
#define ss second
const int N = 1e5 + 10;
bool pri[1000001];
ll c[1001][1001];
/*void binomialCoeff()
{
    //ll C[n + 1][k + 1];
    ll i, j;
    for (i = 0; i <= 1000; i++)
    {
        for (j = 0; j <= min(i, 1000); j++)
        {
            if (j == 0 || j == i)
                C[i][j] = 1;
            else
                C[i][j] = C[i - 1][j - 1] +
                          C[i - 1][j];
        }
    }
    //return C[n][k];
}*/
void sieve()
{
    ll i,j;
    for(i=2;i*i<=1000000;i++)
    {
        if(pri[i])
        {
            for(j=i*i;j<=1000000;j+=i)
                pri[j]=0;
        }
    }
}
ll po(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
ll GCD(ll A, ll B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
int main()
{
    FAST;
    ll n,i,j,k;
    cin>>n;
    ll co[n+1]={0};
    map<ll,pair<ll,ll>> m;
    map<pair<ll,ll>,vector<ll>> m1;
    for(i=0;i<n-2;i++)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        co[a]++;
        co[b]++;
        co[c]++;
        //cout<<co[1]<<endl;
        m[a]={b,c};
        m[b]={a,c};
        m[c]={a,b};
        if(a<b)
            m1[{a,b}].pb(c);
        else
            m1[{b,a}].pb(c);
        if(c<b)
            m1[{c,b}].pb(a);
        else
            m1[{b,c}].pb(a);
        if(a<c)
            m1[{a,c}].pb(b);
        else
            m1[{c,a}].pb(b);
    }
    vector<ll> v;
    for(i=1;i<=n;i++)
    {
        if(co[i]==1)
            v.pb(i);
    }
    vector<ll> ans(n);
    //cout<<co[1]<<endl;
    //cout<<v[0]<<" "<<v[1]<<endl;
    ans[0]=v[0];
    //cout<<co[m[v[0]].ff]<<" "<<co[m[v[0]].ss]<<endl;
    if(co[m[v[0]].ff]==2)
        ans[1]=m[v[0]].ff;
    else
        ans[1]=m[v[0]].ss;
    ans[n-1]=v[1];
    if(co[m[v[1]].ff]==2)
        ans[n-2]=m[v[1]].ff;
    else
        ans[n-2]=m[v[1]].ss;
    //for(i=0;i<n;i++)
      //  cout<<ans[i]<<" ";
    j=2;
    bool vis[n+1]={0};
    vis[ans[0]]=1;
    vis[ans[1]]=1;
    vis[ans[n-1]]=1;
    vis[ans[n-2]]=1;
    //cout<<m1[{2,4}][0]<<" "<<m1[{2,4}][1]<<endl;
    //cout<<m1[{2,3}][0]<<endl;
    for(i=0;i<n-4;i++)
    {
        //cout<<"HI"<<endl;
        ll a,b;
        a=ans[j-1];
        b=ans[j-2];
        if(a>b)
            swap(a,b);
        //cout<<a<<" "<<b<<endl;
        for(k=0;k<m1[{a,b}].size();k++)
        {
            if(vis[m1[{a,b}][k]]==0)
            {
                ans[j]=m1[{a,b}][k];
                break;
            }
        }
        //cout<<m1[{1,2}]<<endl;
        vis[ans[j]]=1;
        j++;
    }
    for(i=0;i<n;i++)
        cout<<ans[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))
#define ll long long int
#define pb push_back
#define INF LONG_LONG_MAX
#define mod 1000000007
#define mp make_pair
#define ff first
#define ss second
const int N = 1e5 + 10;
bool pri[1000001];
void sieve()
{
    ll i,j;
    for(i=2;i*i<=1000000;i++)
    {
        if(pri[i])
        {
            for(j=i*i;j<=1000000;j+=i)
                pri[j]=0;
        }
    }
}
ll po(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
ll GCD(ll A, ll B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
int main()
{
    FAST;
    ll n,i,j,k;
    cin>>n;
    ll co[n+1]={0};
    bool vis[n+1]={0};
    map<pair<ll,ll>,vector<ll>> m;
    ll s1,s2;
    for(i=0;i<n-2;i++)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        if(a==1)
        {
            s1=b;
            s2=c;
        }
        else if(b==1)
        {
            s1=a;
            s2=c;
        }
        else
        {
            s1=a;
            s2=b;
        }
        co[a]++;
        co[b]++;
        co[c]++;
        m[{a,b}].pb(c);
        m[{b,a}].pb(c);
        m[{b,c}].pb(a);
        m[{c,b}].pb(a);
        m[{a,c}].pb(b);
        m[{c,a}].pb(b);
    }
    ll s,ls;
    if(co[s2]==2)
        s1=s2;
    for(i=2;i<=n-1;i++)
    {
        if(co[i]==2)
        {
            s=i;
            break;
        }
    }
    i++;
    for(;i<=n-1;i++)
    {
        if(co[i]==2)
        {
            ls=i;
            break;
        }
    }
    if(s!=s1)
        swap(s,ls);
    //cout<<s<<" "<<ls<<endl;
    ll ans[n];
    ans[0]=1;
    ans[1]=s;
    ans[n-2]=ls;
    ans[n-1]=n;
    vis[1]=1;
    vis[n]=1;
    vis[s]=1;
    vis[ls]=1;
    //cout<<m[{1,4}][0]<<" "<<m[{1,4}][1]<<endl;
    for(i=2;i<n-2;i++)
    {
        vector<ll> t=m[{ans[i-1],ans[i-2]}];
        //cout<<t[0]<<" "<<t[1]<<endl;
        //cout<<vis[t[0]]<<endl;
        if(vis[t[0]]==0)
        {
            ans[i]=t[0];
            vis[t[0]]=1;
        }
        else if(vis[t[1]]==0)
        {
            ans[i]=t[1];
            vis[t[1]]=1;
        }
    }
    for(i=0;i<n;i++)
        cout<<ans[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))
#define ll long long int
#define pb push_back
#define INF LONG_LONG_MAX
#define mod 998244353
#define mp make_pair
#define inf 1e18+5
#define ff first
#define ss second
const int N = 1e5 + 10;
bool pri[1000001];
ll c[1001][1001];
/*void binomialCoeff()
{
    //ll C[n + 1][k + 1];
    ll i, j;
    for (i = 0; i <= 1000; i++)
    {
        for (j = 0; j <= min(i, 1000); j++)
        {
            if (j == 0 || j == i)
                C[i][j] = 1;
            else
                C[i][j] = C[i - 1][j - 1] +
                          C[i - 1][j];
        }
    }
    //return C[n][k];
}*/
void sieve()
{
    ll i,j;
    for(i=2;i*i<=1000000;i++)
    {
        if(pri[i])
        {
            for(j=i*i;j<=1000000;j+=i)
                pri[j]=0;
        }
    }
}
ll po(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
ll GCD(ll A, ll B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
int main()
{
    FAST;
    ll n,i,j;
    cin>>n;
    ll co[n+1]={0};
    map<ll,pair<ll,ll>> m;
    map<pair<ll,ll>,ll> m1;
    for(i=0;i<n-2;i++)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        co[a]++;
        co[b]++;
        co[c]++;
        //cout<<co[1]<<endl;
        m[a]={b,c};
        m[b]={a,c};
        m[c]={a,b};
        if(a>b)
            swap(a,b);
        m1[{a,b}]=c;
        if(b>c)
            swap(b,c);
        m1[{b,c}]=a;
        if(a>c)
            swap(a,c);
        m1[{a,c}]=b;
    }
    vector<ll> v;
    for(i=1;i<=n;i++)
    {
        if(co[i]==1)
            v.pb(i);
    }
    vector<ll> ans(n);
    //cout<<co[1]<<endl;
    //cout<<v[0]<<" "<<v[1]<<endl;
    ans[0]=v[0];
    if(co[m[v[0]].ff]==2)
        ans[1]=m[v[0]].ff;
    else
        ans[1]=m[v[1]].ss;
    ans[n-1]=v[1];
    if(co[m[v[1]].ff]==2)
        ans[n-2]=m[v[1]].ff;
    else
        ans[n-2]=m[v[1]].ss;
    //for(i=0;i<n;i++)
      //  cout<<ans[i]<<" ";
    j=2;
    for(i=0;i<n-4;i++)
    {
        ll a,b;
        a=ans[j-1];
        b=ans[j-2];
        if(a>b)
            swap(a,b);
        ans[j]=m1[{a,b}];
    }
    for(i=0;i<n;i++)
        cout<<ans[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
const int maxn=1000000;
int n,m;
int a[maxn];
int b[maxn];
struct node{
	int x,y,z;
}p[maxn];
struct node1{
	int v,nxt;
}T[maxn*5];
int h[maxn],len;
int belong[maxn];
void add1(int i,int j){
	len++; T[len].nxt=h[i]; T[len].v=j; h[i]=len;
}
bool f[maxn],f1[maxn];
void dfs(int x,int cnt){
	cout<<x<<' ';
	if(cnt>2 && cnt<n-2){
		for(int i=h[x]; i ; i=T[i].nxt){
		if(!f[T[i].v] && f1[T[i].v]==false){
			f[T[i].v]=true; dfs(T[i].v,cnt+1);
		}
		}
	}
	else if(cnt==2 || cnt==n-3){
		for(int i=h[x]; i ; i=T[i].nxt){
		if(!f[T[i].v] && f1[T[i].v]==true && a[T[i].v]==3){
			f[T[i].v]=true; dfs(T[i].v,cnt+1);
		}
		}
	}
	else{
	for(int i=h[x]; i ; i=T[i].nxt){
		if(!f[T[i].v] && a[T[i].v]==2){
			f[T[i].v]=true; dfs(T[i].v,cnt+1);
		}
		}
	}
}
int main(){
    cin>>n;
    for(int i=1; i<=n-2; i++){
    	int x,y,z;
    	scanf("%d %d %d",&x,&y,&z);
    	a[x]++; a[y]++; a[z]++;
    	b[x+y]++; b[x+z]++; b[y+z]++;
    	p[i].x=x; p[i].y=y; p[i].z=z;
    	add1(x,y); add1(y,x);
    	add1(x,z); add1(z,x);
    	add1(y,z); add1(z,y);
    	belong[x]=i; belong[y]=i; belong[z]=i;
	}
	bool flag=false;
	for(int i=1; i<=n; i++){
		if(a[i]==1){
			f1[p[belong[i]].x]=true;
			f1[p[belong[i]].y]=true;
			f1[p[belong[i]].z]=true;
		}
	}
	for(int i=1; i<=n; i++){
		if(a[i]==1){
			if(!flag){
				f[i]=true; dfs(i,1); flag=true;
			}
			else{
				cout<<i<<endl; break;
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn=1000000;
int n,m;
int a[maxn];
struct node{
	int x,y,z;
}p[maxn];
struct node1{
	int v,nxt;
}T[maxn*5];
int h[maxn],len;
int b[maxn][4];
bool f[maxn];
void add1(int i,int j){
	len++; T[len].nxt=h[i]; T[len].v=j; h[i]=len;
}
void dfs(int x){
	cout<<x<<' '; f[x]=true;
	for(int i=1; i<=b[x][0]; i++){
		int Now=b[x][i];
		if(a[p[Now].x]!=1){
			a[p[Now].x]--;
			if(a[p[Now].x]==1){
				dfs(p[Now].x);
			}
		}
		if(a[p[Now].y]!=1){
			a[p[Now].y]--;
			if(a[p[Now].y]==1){
				dfs(p[Now].y);
			}
		}
		if(a[p[Now].z]!=1){
			a[p[Now].z]--;
			if(a[p[Now].z]==1){
				dfs(p[Now].z);
			}
		}
		if(a[p[Now].y]==1 && !f[p[Now].y]){
			dfs(p[Now].y);
		}
		if(a[p[Now].z]==1 && !f[p[Now].z]){
			dfs(p[Now].z);
		}
		if(a[p[Now].x]==1 && !f[p[Now].x]){
			dfs(p[Now].x);
		}
	}
}
int main(){
	freopen("test.in","r",stdin);
	freopen("test.out","w",stdout);
    cin>>n;
    for(int i=1; i<=n-2; i++){
    	int x,y,z;
    	scanf("%d %d %d",&x,&y,&z);
    	a[x]++; a[y]++; a[z]++;
    	p[i].x=x; p[i].y=y; p[i].z=z;
    	add1(x,y); add1(y,x);
    	add1(x,z); add1(z,x);
    	add1(y,z); add1(z,y);
    	b[x][0]++; b[x][b[x][0]]=i;
    	b[y][0]++; b[y][b[y][0]]=i;
    	b[z][0]++; b[z][b[z][0]]=i;
	}
	bool flag=false;
	for(int i=1; i<=n; i++) if(a[i]==2) a[i]=1;
	for(int i=1; i<=n; i++){
		if(a[i]==1){
			if(!flag){
				f[i]=true;
				dfs(i); return 0;
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn=1000000;
int n,m;
int a[maxn];
struct node{
	int x,y,z;
}p[maxn];
struct node1{
	int v,nxt;
}T[maxn*5];
int h[maxn],len;
int b[maxn][4];
bool f[maxn],f1[maxn];
void add1(int i,int j){
	len++; T[len].nxt=h[i]; T[len].v=j; h[i]=len;
}
void dfs(int x){
	cout<<x<<' '; f[x]=true;
	for(int i=1; i<=b[x][0]; i++){
		int Now=b[x][i];
		if(a[p[Now].x]!=1){
			a[p[Now].x]--;
			if(a[p[Now].x]==1){
				dfs(p[Now].x);
			}
		}
		if(a[p[Now].y]!=1){
			a[p[Now].y]--;
			if(a[p[Now].y]==1){
				dfs(p[Now].y);
			}
		}
		if(a[p[Now].z]!=1){
			a[p[Now].z]--;
			if(a[p[Now].z]==1){
				dfs(p[Now].z);
			}
		}
		if(a[p[Now].y]==1 && !f[p[Now].y]){
			dfs(p[Now].y);
		}
		if(a[p[Now].z]==1 && !f[p[Now].z]){
			dfs(p[Now].z);
		}
		if(a[p[Now].x]==1 && !f[p[Now].x]){
			dfs(p[Now].x);
		}
	}
}
int main(){
    cin>>n;
    for(int i=1; i<=n-2; i++){
    	int x,y,z;
    	scanf("%d %d %d",&x,&y,&z);
    	a[x]++; a[y]++; a[z]++;
    	p[i].x=x; p[i].y=y; p[i].z=z;
    	add1(x,y); add1(y,x);
    	add1(x,z); add1(z,x);
    	add1(y,z); add1(z,y);
    	b[x][0]++; b[x][b[x][0]]=i;
    	b[y][0]++; b[y][b[y][0]]=i;
    	b[z][0]++; b[z][b[z][0]]=i;
	}
	bool flag=false;
	for(int i=1; i<=n; i++) if(a[i]==2) f1[i]=true,a[i]=1;
	for(int i=1; i<=n; i++){
		if(a[i]==1 && !f1[i]){
			if(!flag){
				f[i]=true;
				dfs(i); return 0;
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn=1000000;
int n,m;
int a[maxn];
struct node{
	int x,y,z;
}p[maxn];
struct node1{
	int v,nxt;
}T[maxn*5];
int h[maxn],len;
int b[maxn][4];
bool f[maxn];
void add1(int i,int j){
	len++; T[len].nxt=h[i]; T[len].v=j; h[i]=len;
}
void dfs(int x){
	cout<<x<<' '; f[x]=true;
	for(int i=1; i<=b[x][0]; i++){
		int Now=b[x][i];
		if(a[p[Now].x]!=1){
			a[p[Now].x]--;
			if(a[p[Now].x]==1){
				dfs(p[Now].x);
			}
		}
		if(a[p[Now].y]!=1){
			a[p[Now].y]--;
			if(a[p[Now].y]==1){
				dfs(p[Now].y);
			}
		}
		if(a[p[Now].z]!=1){
			a[p[Now].z]--;
			if(a[p[Now].z]==1){
				dfs(p[Now].z);
			}
		}
		if(a[p[Now].y]==1 && !f[p[Now].y]){
			dfs(p[Now].y);
		}
		if(a[p[Now].z]==1 && !f[p[Now].z]){
			dfs(p[Now].z);
		}
		if(a[p[Now].x]==1 && !f[p[Now].x]){
			dfs(p[Now].x);
		}
	}
}
int main(){
    cin>>n;
    for(int i=1; i<=n-2; i++){
    	int x,y,z;
    	scanf("%d %d %d",&x,&y,&z);
    	a[x]++; a[y]++; a[z]++;
    	p[i].x=x; p[i].y=y; p[i].z=z;
    	add1(x,y); add1(y,x);
    	add1(x,z); add1(z,x);
    	add1(y,z); add1(z,y);
    	b[x][0]++; b[x][b[x][0]]=i;
    	b[y][0]++; b[y][b[y][0]]=i;
    	b[z][0]++; b[z][b[z][0]]=i;
	}
	bool flag=false;
	for(int i=1; i<=n; i++) if(a[i]==2) a[i]=1;
	for(int i=1; i<=n; i++){
		if(a[i]==1){
			if(!flag){
				f[i]=true;
				dfs(i); return 0;
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn=1000000;
int n,m;
int a[maxn];
int b[maxn];
struct node{
	int v,nxt;
}T[maxn*5];
int h[maxn],len;
void add1(int i,int j){
	len++; T[len].nxt=h[i]; T[len].v=j; h[i]=len;
}
bool f[maxn];
void dfs(int x){
	cout<<x<<' ';
	for(int i=h[x]; i ; i=T[i].nxt){
		if(!f[T[i].v] && a[T[i].v]==2){
			f[T[i].v]=true; dfs(T[i].v);
		}
	}
	for(int i=h[x]; i ; i=T[i].nxt){
		if(!f[T[i].v] && a[T[i].v]==3){
			f[T[i].v]=true; dfs(T[i].v);
		}
	}

}
int main(){
    cin>>n;
    for(int i=1; i<=n-2; i++){
    	int x,y,z;
    	scanf("%d %d %d",&x,&y,&z);
    	a[x]++; a[y]++; a[z]++;
    	b[x+y]++; b[x+z]++; b[y+z]++;
    	add1(x,y); add1(y,x);
    	add1(x,z); add1(z,x);
    	add1(y,z); add1(z,y);
	}
	bool flag=false;
	for(int i=1; i<=n; i++){
		if(a[i]==1){
			if(!flag){
				f[i]=true; dfs(i); flag=true;
			}
			else{
				cout<<i<<endl; break;
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn=1000000;
int n,m;
int a[maxn];
int b[maxn];
struct node{
	int v,nxt;
}T[maxn*5];
int h[maxn],len;
void add1(int i,int j){
	len++; T[len].nxt=h[i]; T[len].v=j; h[i]=len;
}
bool f[maxn];
void dfs(int x,int cnt){
	cout<<x<<' ';
	for(int i=h[x]; i ; i=T[i].nxt){
		if(!f[T[i].v] && a[T[i].v]==2 && (cnt==1 || cnt==n-2)){
			f[T[i].v]=true; dfs(T[i].v,cnt+1);
		}
	}
	for(int i=h[x]; i ; i=T[i].nxt){
		if(!f[T[i].v] && a[T[i].v]==3){
			f[T[i].v]=true; dfs(T[i].v,cnt+1);
		}
	}

}
int main(){
    cin>>n;
    for(int i=1; i<=n-2; i++){
    	int x,y,z;
    	scanf("%d %d %d",&x,&y,&z);
    	a[x]++; a[y]++; a[z]++;
    	b[x+y]++; b[x+z]++; b[y+z]++;
    	add1(x,y); add1(y,x);
    	add1(x,z); add1(z,x);
    	add1(y,z); add1(z,y);
	}
	bool flag=false;
	for(int i=1; i<=n; i++){
		if(a[i]==1){
			if(!flag){
				f[i]=true; dfs(i,1); flag=true;
			}
			else{
				cout<<i<<endl; break;
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define se second
#define fi first
#define pii pair<int,int>
#define lowbit(x) x&(-x)
typedef long long ll;
int lson(int p) {return p * 2;}
int rson(int p) {return p * 2 + 1;}
const int mod = 1e9 + 7;
const int maxn = 2e5 + 10;
const long long int inf = 1e17 + 10;

struct node{
    int p[3];
}a[maxn];
struct B{
    int b[3];
    int now;
}belong[maxn];

int ans[maxn],vis[maxn];
int cnt[maxn];
int main()
{
    int n;scanf("%d",&n);
    for(int i = 1; i <= n; i++)
    {
        belong[i].now = 0;
    }
    for(int i = 1;i <= n - 2; i++)
    {
        scanf("%d%d%d",&a[i].p[0],&a[i].p[1],&a[i].p[2]);

        cnt[a[i].p[0] ]++;
        cnt[a[i].p[1] ]++;
        cnt[a[i].p[2] ]++;
        belong[a[i].p[0] ].b[belong[a[i].p[0] ].now++] = i;
        belong[a[i].p[1] ].b[belong[a[i].p[1] ].now++] = i;
        belong[a[i].p[2] ].b[belong[a[i].p[2] ].now++] = i;
    }
    int be = 0,vv = 0,tot = 0,en = 0;
    for(int i = 1; i <= n; i++)
    {
        if(cnt[i] == 1 && be == 0)
        {
            be = belong[i].b[0];
            ans[++tot] = i;
        }
        else if(cnt[i] == 1 && vv == 0)
        {
            vv = i;
            en = belong[i].b[0];
        }
    }
    ans[n] = vv;
    for(int i = 0; i < 3; i++)
    {
        if(cnt[a[en].p[i]] == 2)
        {
            ans[n - 1] = a[en].p[i];
        }
        else if(cnt[a[en].p[i]] == 3)
        {
            ans[n - 2] = a[en].p[i];
        }
    }
    bool flag = 0;
    vis[be] = 1;
   // printf("vv = %d\n",vv);
    while(1)
    {
        //printf("be = %d\n",be);
        //cout<<tot<<endl;
        if(be == en) break;
        if(tot >= n - 3) break;
        for(int i = 0; i < 3; i++)
        {
            //printf("pi = %d\n",a[be].p[i]);
            if(a[be].p[i] == vv) flag = 1;
        }
        if(flag) break;
        for(int i = 0; i < 3; i++)
        {
            cnt[a[be].p[i]]--;
            if(cnt[a[be].p[i]] == 1)
            {
                ans[++tot] = a[be].p[i];
                for(int j = 0; j < belong[a[be].p[i]].now; j++)
                {
                    //printf("check %d\n",belong[a[be].p[i]].b[j]);
                    if(!vis[belong[a[be].p[i]].b[j]])
                    {
                        be = belong[a[be].p[i]].b[j];
                        vis[be] = 1;
                        break;
                    }
                }
                break;
            }
        }
    }
    for(int i = 1; i <= n; i++)
    {
        printf("%d ",ans[i]);
    }
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define se second
#define fi first
#define pii pair<int,int>
#define lowbit(x) x&(-x)
typedef long long ll;
int lson(int p) {return p * 2;}
int rson(int p) {return p * 2 + 1;}
const int mod = 1e9 + 7;
const int maxn = 2e5 + 10;
const long long int inf = 1e17 + 10;

struct node{
    int p[3];
}a[maxn];
struct B{
    int b[3];
    int now;
}belong[maxn];

int ans[maxn],vis[maxn];
int cnt[maxn];
int main()
{
    int n;scanf("%d",&n);
    for(int i = 1; i <= n; i++)
    {
        belong[i].now = 0;
    }
    for(int i = 1;i <= n - 2; i++)
    {
        scanf("%d%d%d",&a[i].p[0],&a[i].p[1],&a[i].p[2]);

        cnt[a[i].p[0] ]++;
        cnt[a[i].p[1] ]++;
        cnt[a[i].p[2] ]++;
        belong[a[i].p[0] ].b[belong[a[i].p[0] ].now++] = i;
        belong[a[i].p[1] ].b[belong[a[i].p[1] ].now++] = i;
        belong[a[i].p[2] ].b[belong[a[i].p[2] ].now++] = i;
    }
    int be = 0,vv = 0,tot = 0,en = 0;
    for(int i = 1; i <= n; i++)
    {
        if(cnt[i] == 1 && be == 0)
        {
            be = belong[i].b[0];
            ans[++tot] = i;
        }
        else if(cnt[i] == 1 && vv == 0)
        {
            vv = i;
            en = belong[i].b[0];
        }
    }
    ans[n] = vv;
    for(int i = 0; i < 3; i++)
    {
        if(cnt[a[en].p[i]] == 2)
        {
            ans[n - 1] = a[en].p[i];
        }
        else if(cnt[a[en].p[i]] == 3)
        {
            ans[n - 2] = a[en].p[i];
        }
    }
    bool flag = 0,ff = 0;
    int last = tot;
   // printf("vv = %d\n",vv);
    while(1)
    {
        //printf("be = %d\n",be);
        //cout<<tot<<endl;
        if(ff == 1)
        {
            if(last == tot) break;
            last = tot;
        }
        else ff = 1;
        if(tot >= n - 3) break;
        vis[be] = 1;
        for(int i = 0; i < belong[a[be].p[i]].now; i++)
        {
            //printf("pi = %d\n",a[be].p[i]);
            if(a[be].p[i] == vv) flag = 1;
        }
        if(flag) break;
        for(int i = 0; i < 3; i++)
        {
            cnt[a[be].p[i]]--;
            if(cnt[a[be].p[i]] == 1)
            {
                ans[++tot] = a[be].p[i];
                for(int j = 0; j < belong[a[be].p[i]].now; j++)
                {
                    //printf("check %d\n",belong[a[be].p[i]].b[j]);
                    if(!vis[belong[a[be].p[i]].b[j]])
                    {
                        be = belong[a[be].p[i]].b[j];
                        break;
                    }
                }
                break;
            }
        }
    }
    for(int i = 1; i <= n; i++)
    {
        printf("%d ",ans[i]);
    }
	return 0;
}