#include "triangles.h"

std::vector<std::vector<int>> solve(int n) {
    std::vector<std::vector<int>> ans;
    for (int i = 0; i < n; ++i) {
        std::vector<int> oth;
        for (int j=0;j<n;++j) {
            if (j != i) {
                oth.push_back(j);
            }
        }
        std::vector<Triangle> left = {Triangle(oth[0], oth[1], oth[2])};
        std::vector<Triangle> right;
        for (int j = 0; j < 3; ++j) {
            right.emplace_back(oth[j], oth[(j + 1) % 3], i);
        }
        int res = compare(left, right);
        if (res == 1) {
            for (Triangle& t : right) {
                ans.push_back({t.i, t.j, t.k});
            }
            return ans;
        }
    }
    ans.emplace_back();
    for (int i = 0; i < n; ++i) {
        ans.back().emplace_back(i);
    }
    // for (int i = 0; i < n; ++i) {
    //     for (int j = 0; j < i; ++j) {
    //         for (int k = 0; k < n; ++k) {
    //             if (k == i || k == j) continue;
    //             for (int l = 0; l < n; ++l) {
    //                 if (l == i || l == j || l == k) continue;
    //                 std::vector<Triangle> left = {Triangle(i, j, k)};
    //                 std::vector<Triangle> right;
    //             }
    //         }
    //     }
    // }
    return ans;
}
