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

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

    for(int bad = 0; bad < n; bad++){
        bool OK = 1;
        vector<Triangle> left;
        vector<vector<int>> res;
        for(int i = 0; i < n; i++){
            for(int j = i + 1; j < n; j++){
                if(i == bad || j == bad) continue;
                left.push_back(Triangle(bad, i, j));
                res.push_back({bad, i, j});
            }
        }
        vector<int> last;
        for(int i = 0; i < n; i++) last.push_back(i);
        last.erase(find(last.begin(), last.end(), bad));
        vector<Triangle> right = {Triangle(last[0], last[1], last[2])};
        int compare_result = compare(left, right);
        if(compare_result == 0){
            return res;
        }
    }
    for(int bad = 0; bad < n; bad++){
        for(int cent = 0; cent < n; cent++){
            vector<int> last;
            for(int i = 0; i < n; i++) if(i != cent && i != bad) last.push_back(i);
            bool OK = 1;
            vector<Triangle> left;
            vector<Triangle> right;
            left.push_back(Triangle(bad, cent, last[0]));
            left.push_back(Triangle(bad, cent, last[1]));
            right.push_back(Triangle(bad, last[1], last[0]));
            right.push_back(Triangle(cent, last[1], last[1]));
            int compare_result = compare(left, right);

            vector<vector<int>> res;
            res.push_back({bad, cent, last[0]});
            res.push_back({bad, cent, last[1]});
            if(compare_result == 0){
                return res;
            }
        }
    }
    /*
    vector<Triangle> left = {Triangle(0, 1, 2)};
    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;
    */
}
