#include "triangles.h"
using namespace std;
typedef long long ll;
int inTr(int a, int b, int c, int i) {
	vector<Triangle> left = { Triangle(a, b, c) };
	vector<Triangle> right = { Triangle(a, b, i), Triangle(a, c, i), Triangle(b, c, i) };
	int res = compare(left, right);
	return res;
}
vector<std::vector<int>> solve(int n) {
	vector<vector<int>> ans;
	for (int i = 0; i < n; i++) {
		int a = (i + 1) % n, b = (i + 2) % n, c = (i + 3) % n;
		if (inTr(a, b, c, i)==0) {
			ans = { {a, b, i}, {a, c, i}, {b, c, i} };
			return ans;
		}
	}
	for (int i = 0; i < n; i++) {
		int a = (i + 1) % n, b = (i + 2) % n, c = (i + 3) % n;

		vector<Triangle> left = { Triangle(a, b, i), Triangle(c, b, i) };
		vector<Triangle> right = { Triangle(b, a, i), Triangle(c, a, i) };
		int res = compare(left, right);
		auto eq = left;
		if (res == -1)
			eq = right;
		vector<Triangle> mid = { Triangle(b, c, i), Triangle(a, c, i) };
		res = compare(eq, mid);
		auto eq = eq;
		if (res == -1)
			eq = mid;
		int A = eq[0][0], B = eq[0][1], D = eq[0][2], C = eq[1][0];
		ans = { {A, B, D}, {C, B, D} };
	}
	return ans;
}
