#include "triangles.h"
using namespace std;

std::vector<std::vector<int>> solve(int n) {
	if (n == 4) {
		bool fl0 = 0, fl1 = 0, fl2 = 0, fl3 = 0;
		vector<Triangle> left;
		vector<Triangle> right;
		left.push_back(Triangle(0, 1, 2));
		left.push_back(Triangle(0, 1, 3));
		left.push_back(Triangle(0, 2, 3));
		right.push_back(Triangle(1, 2, 3));
		int c = compare(left, right);
		if (c == 0) {
			fl0 = 1;
		}
		left.clear();
		right.clear();

		left.push_back(Triangle(1, 2, 0));
		left.push_back(Triangle(1, 3, 0));
		left.push_back(Triangle(1, 2, 3));
		right.push_back(Triangle(0, 2, 3));
		c = compare(left, right);
		if (c == 0) {
			fl1 = 1;
		}
		left.clear();
		right.clear();

		left.push_back(Triangle(2, 1, 0));
		left.push_back(Triangle(2, 3, 0));
		left.push_back(Triangle(2, 3, 1));
		right.push_back(Triangle(0, 1, 3));
		c = compare(left, right);
		if (c == 0) {
			fl2 = 1;
		}
		left.clear();
		right.clear();

		left.push_back(Triangle(3, 0, 1));
		left.push_back(Triangle(3, 0, 2));
		left.push_back(Triangle(3, 1, 2));
		right.push_back(Triangle(0, 1, 2));
		c = compare(left, right);
		if (c == 0) {
			fl3 = 1;
		}
		left.clear();
		right.clear();

		if (fl0 == 1) {
			vector<vector<int>> ans;
			ans.push_back({ 0, 1, 2 });
			ans.push_back({ 0, 1, 3 });
			ans.push_back({ 0, 2, 3 });
			//vector<int> h = { 1, 2, 3 };
			//ans.push_back(h);
			return ans;
		}
		if (fl1 == 1) {
			vector<vector<int>> ans;
			ans.push_back({ 0, 1, 2 });
			ans.push_back({ 0, 1, 3 });
			ans.push_back({ 1, 2, 3 });
			return ans;
		}
		if (fl2 == 1) {
			vector<vector<int>> ans;
			ans.push_back({ 0, 1, 2 });
			ans.push_back({ 1, 2, 3 });
			ans.push_back({ 0, 2, 3 });
			return ans;
		}
		if (fl3 == 1) {
			vector<vector<int>> ans;
			ans.push_back({ 1, 2, 3 });
			ans.push_back({ 0, 1, 3 });
			ans.push_back({ 0, 2, 3 });
			return ans;
		}

		vector<vector<int>> ans;
		left.push_back(Triangle(0, 1, 2));
		left.push_back(Triangle(0, 1, 3));
		right.push_back(Triangle(0, 2, 3));
		right.push_back(Triangle(1, 2, 3));
		c = compare(left, right);
		if (c == 0) {
			ans.push_back({ 0, 1, 2 });
			ans.push_back({ 0, 1, 3 });
			return ans;
		}
		left.clear();
		right.clear();

		left.push_back(Triangle(0, 1, 2));
		left.push_back(Triangle(0, 2, 3));
		right.push_back(Triangle(0, 1, 3));
		right.push_back(Triangle(1, 2, 3));
		c = compare(left, right);
		if (c == 0) {
			ans.push_back({ 0, 1, 2 });
			ans.push_back({ 0, 2, 3 });
			return ans;
		}
		left.clear();
		right.clear();

		left.push_back(Triangle(0, 2, 3));
		left.push_back(Triangle(0, 1, 3));
		right.push_back(Triangle(0, 1, 2));
		right.push_back(Triangle(1, 2, 3));
		c = compare(left, right);
		if (c == 0) {
			ans.push_back({ 0, 2, 3 });
			ans.push_back({ 0, 1, 3 });
			return ans;
		}
		left.clear();
		right.clear();
		return ans;
	}
    // Example of compare:
    // Пример использования функции compare:
    std::vector<Triangle> left = {Triangle(0, 1, 2)};
    std::vector<Triangle> right = {Triangle(0, 1, 2)};
    int compare_result = compare(left, right);
    // compare_result should be equal to 0.
    // compare_result будет равняться нулю, так как сравнивались одинаковые треугольники.
    
    // Example of return:
    // Пример возвращаемого значения:
    std::vector<std::vector<int>> ans;
    ans.push_back(std::vector<int>(n));
    for (int i = 0; i < n; ++i) {
        ans[0][i] = i;
    }
    return ans;
}
