#include "triangles.h"
using namespace std;

std::vector<std::vector<int>> solve(int n) {
    for (int i = 0; i < 4; i++) {
        vector<Triangle> left, right;
        vector<int> except;
        for (int j = 0; j < 4; j++) {
            if (j != i) except.push_back(j);
        }
        for (int j = 0; j < 3; j++) {
            left.push_back(Triangle({except[j], except[(j + 1) % 3], i}));
        }
        right = {Triangle{except[0], except[1], except[2]}};

        bool comp = compare(left, right);
        if (comp == 0) {
            vector<vector<int>> ans;
            ans.push_back(except);
            return ans;
        }
    }
    for (int i = 0; i < n; i++){
        for (int j = i + 1; j < n; j++) {
            vector<int> except;
            for (int k = 0; k < n; k++) {
                if (k != i && k != j) {
                    except.push_back(k);
                }
            }
            vector<Triangle> left = {Triangle(i, j, except[0]), Triangle(i, j, except[1])};
            vector<Triangle> right = {Triangle(i, except[1], except[0]), Triangle(except[0], j, except[1])};
            bool comp = compare(left, right);
            if (comp == 0) {
                vector<vector<int>> ans(2);
                ans[0] = {i, j, except[0]};
                ans[1] = {i, j, except[1]};
                return ans;
            }
        }
    }

}
