#include "triangles.h"
#include "bits/stdc++.h"

using namespace std;

std::vector<std::vector<int>> solve(int n) {
    // Example of compare:
    // Пример использования функции compare:

    vector<int> ord = {0, 1, 2, 3};
    do {
        vector<Triangle> left = {
                Triangle(ord[0], ord[1], ord[3]),
                Triangle(ord[1], ord[2], ord[3])
        };
        vector<Triangle> right = {
                Triangle(ord[0], ord[1], ord[2]),
                Triangle(ord[0], ord[2], ord[3])
        };

        int compare_result = compare(left, right);
        if (compare_result == 0) {
            return {ord};
        }
    } while (std::next_permutation(ord.begin(), ord.end()));

    vector<int> best = {0, 1, 2};
    for (int i = 0; i < 4; ++i) {
        for (int j = 0; j < 4; ++j) {
            for (int k = 0; k < 4; ++k) {
                if (i == j || j == k || i == k) continue;
                if (compare({Triangle(best[0], best[1], best[2])},
                            {Triangle(i, j, k)}) == -1) {
                    best = {i, j, k};
                }
            }
        }
    }
    return {best};
}
