#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<iomanip>
#include<queue>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include<cmath>
#include<algorithm>
#include<random>
#include<ctime>
"triangles.h"

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,bmi,popcnt")

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uint = unsigned int;

mt19937 mt(time(0));
const int N = 1e4 + 2, mod = 998244353, inf = 1e9 + 100;
const ll llinf = 1e18 + 1000;

int compare(const vector<Triangle>& left, const vector<Triangle>& right);

int check(vector<vector<int>> al, vector<vector<int>> ar) {
	vector<Triangle> bl, br;
	for (auto p : al) bl.push_back({p[0], p[1], p[2]});
	for (auto p : ar) br.push_back({p[0], p[1], p[2]});
	return compare(bl, br);
}

vector<vector<int>> solve(int n) {
	vector<int> a = {0, 1, 2, 3};
	if (check({{a[0], a[1], a[2]}}, {{a[0], a[1], a[3]}, {a[0], a[2], a[3]}, {a[1], a[2], a[3]}}) == 0) {
		return {{a[0], a[1], a[3]}, {a[0], a[2], a[3]}, {a[1], a[2], a[3]}};
	}
	swap(a[0], a[3]);
	if (check({{a[0], a[1], a[2]}}, {{a[0], a[1], a[3]}, {a[0], a[2], a[3]}, {a[1], a[2], a[3]}}) == 0) {
		return {{a[0], a[1], a[3]}, {a[0], a[2], a[3]}, {a[1], a[2], a[3]}};
	}
	swap(a[1], a[3]);
	if (check({{a[0], a[1], a[2]}}, {{a[0], a[1], a[3]}, {a[0], a[2], a[3]}, {a[1], a[2], a[3]}}) == 0) {
		return {{a[0], a[1], a[3]}, {a[0], a[2], a[3]}, {a[1], a[2], a[3]}};
	}
	swap(a[2], a[3]);
	if (check({{a[0], a[1], a[2]}}, {{a[0], a[1], a[3]}, {a[0], a[2], a[3]}, {a[1], a[2], a[3]}}) == 0) {
		return {{a[0], a[1], a[3]}, {a[0], a[2], a[3]}, {a[1], a[2], a[3]}};
	}
	a = {0, 1, 2, 3};
	do {
		if (check({{a[0], a[1], a[2]}, {a[0], a[2], a[3]}}, {{a[1], a[2], a[3]}, {a[1], a[3], a[0]}}) == 0) {
			return {{a[0], a[1], a[2]}, {a[0], a[2], a[3]}};
		}
	}while (next_permutation(all(a)));
}


/*signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int tt = 1;
	//cin >> tt;
	while (tt--) {
		solve();
		cout << '\n';
		cout.flush();
	}
	return 0;
}*/