#include "triangles.h"

using namespace std;

// n == 4
vector<vector<int>> solve(int n) {
	if (n != 4) {
		return {{0, 1, 2}};
	}
	vector<Triangle> trs = {{0, 1, 2}, {0, 1, 3}, {0, 2, 3}, {1, 2, 3}};
	int mx = 0;
	for (int i = 1; i < trs.size(); ++i) {
		int c = compare({trs[i]}, {trs[mx]});
		if (c == 1) {
			mx = i;
		}
	}
	int i = trs[mx].i;
	int j = trs[mx].j;
	int k = trs[mx].k;
	int l = 0 + 1 + 2 + 3 - i - j - k;
	vector<Triangle> anst = {
		{l, i, j},	
		{l, j, k},	
		{l, i, k},	
	};
	vector<vector<int>> ans = {
		{l, i, j},	
		{l, j, k},	
		{l, i, k},	
	};
	if (compare(anst, {trs[mx]}) == 0) { 
		return ans;
	} else {
		for (int p = 0; p < 4; ++p) {
			for (int q = 0; q < 4; ++q) {
				for (int r = 0; r < 4; ++r) {
					if (p == q || q == r || p == r || p == l || q == l || r == l) continue;
					if (compare({{l, p, q}, {l, p, r}}, {{q, r, p}, {q, r, l}}) == 0) {
						return {{l, r, q}, {p, r, q}};
					}
				}
			}
		}
		return {{i, j, k}, {i, j, l}};
	}
}
