#include "triangles.h"
#include <iostream>
#include <vector>
#include <cstdint>
#include <algorithm>
#include <cmath>
using namespace std;
vector<vector<int>> solve(int n) {
	vector<vector<int>> ans;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			vector<int> vr;
			for (int k = 0; k < n; k++) {
				if (k != i && k != j) vr.push_back(k);
			}
			int cmp = compare({ Triangle(i, j, vr[0]), Triangle(i, j, vr[1]) }, { Triangle(vr[0], vr[1], i), Triangle(vr[0], vr[1], j) });
			if (cmp == 0) {
				ans.assign(2, {});
				ans[0] = { i, j, vr[0] }; ans[1] = { i, j, vr[1] };
				return ans;
			}
		}
	}
	int a0 = 0, b0 = 1;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			vector<int> vr;
			for (int k = 0; k < n; k++) {
				if (k != i && k != j) vr.push_back(k);
			}
			int cmp = compare({ Triangle(i, j, vr[0]), Triangle(i, j, vr[1]) }, { Triangle(0, 1, 2), Triangle(0, 1, 3) });
			if (cmp == 1) {
				a0 = i, b0 = j;
			}
		}
	}
	ans.resize(3);
	vector<int> vr;
	for (int k = 0; k < n; k++) {
		if (k != a0 && k != b0) vr.push_back(k);
	}
	int cmp = compare({ Triangle(a0, b0, vr[0]) }, { Triangle(a0, b0, vr[1]) });
	if (cmp == 1) {
		swap(vr[0], vr[1]);
	}
	ans[0] = { a0, b0, vr[0] }; ans[1] = { a0, vr[0], vr[1] }; ans[2] = { b0, vr[0], vr[1] };
	return ans;
}