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

vector<vector<int>> solve(int n){
    int centr = -1;
    for(int i = 0; i < 4; i++){
        vector<int> u;
        for(int j = 0; j < 4; j++){
            if(i != j){
                u.push_back(j);
            }
        }
        auto Triangle1 = Triangle(u[0], u[1], u[2]);
        auto tri1 = Triangle(i, u[1], u[2]), tri2 = Triangle(u[0], i, u[2]), tri3 = Triangle(u[0], u[1], i);
        int x = compare({Triangle1}, {tri1, tri2, tri3});
        if(x == 0){
            centr = i;
        }
    }
    vector<vector<int>> r;
    if(centr != -1){

        vector<int> u;
        for(int j = 0; j < 4; j++){
            if(centr != j){
                u.push_back(j);
            }
        }
        r.push_back({centr, u[1], u[2]});
        r.push_back({u[0], centr, u[2]});
        r.push_back({u[0], u[1], centr});
        return r;
    }
    pair<int, int> opp;
    for(int i = 0; i < 4; i++){
        for(int j = i + 1; j < 4; j++){
            vector<int> u;
            for(int k = 0; k < 4; k++){
                if(k != i && k!= j){
                    u.push_back(k);
                }
            }
            auto tri1 = Triangle(i, j, u[0]), tri2 = Triangle(i, j, u[1]);
            auto Tri1 = Triangle(i, u[1], u[0]), Tri2 = Triangle(u[1], j, u[0]);
            if(compare({tri1, tri2}, {Tri1, Tri2}) == 0){
                opp = {i, j};
            }
        }
    }
    vector<int> u;
    for(int k = 0; k < 4; k++){
        if(k != opp.first && k!= opp.second){
            u.push_back(k);
        }
    }
    r.push_back({opp.first, opp.second, u[0]});
    r.push_back({opp.first, opp.second, u[1]});
    return r;
}
