#include "triangles.h"
#include <bits/stdc++.h>
using namespace std;

mt19937 rnd(time(0));

vector<vector<int> > solve(int n) {
    set<int> vec;
    for (int x = 0; x < n; ++x) {
        for (int y = x + 1; y < n; ++y) {
            vector<int> p;
            for (int i = 0; i < n; ++i) {
                if (i == x || i == y) {
                    continue;
                }
                if (p.empty()) {
                    p.emplace_back(i);
                } else {
                    std::vector<Triangle> left = {Triangle(x, y, p[0])};
                    std::vector<Triangle> right = {Triangle(x, y, i)};
                    int c = compare(left, right);
                    if (c == -1) {
                        p = {i};
                    }
                    if (c == 0) {
                        p.emplace_back(i);
                    }
                }
            }
            for (auto it: p) {
                vec.insert(it);
            }
        }
    }
    if (vec.size() == 3) {
        std::vector<std::vector<int> > ans;
        vector<int> vec1;
        for (auto it: vec) {
            vec1.emplace_back(it);
        }
        ans.emplace_back(vec1);
        return ans;
    }
    vector<int> v = {0, 1, 2, 3};
    do {
        std::vector<Triangle> left = {Triangle(v[0], v[1], v[2])};
        std::vector<Triangle> right = {Triangle(v[2], v[3], v[0])};
        int c = compare(left, right);
        if (c != 0) {
            continue;
        }
        left = {Triangle(v[1], v[2], v[3])};
        right = {Triangle(v[3], v[0], v[1])};
        c = compare(left, right);
        if (c != 0) {
            continue;
        }
        return {v};
    } while (next_permutation(v.begin(), v.end()));
}
