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

#pragma GCC optimize("O3", "Ofast", "unroll-loops", "fast-math")
#pragma GCC target("avx", "avx2")

using ll = int;
using lll = __int128;
using dd = long double;
using para = pair <ll, ll>;
using parad = pair <dd, dd>;
using vll = vector <ll>;
vector<vector<int>> solve(int n) {
    vector <vector <int>> ans;
    if (n == 4) {
        ll ind = -1;
        for (ll i = 0; i < n; ++i) {
            vector <Triangle> left;
            vector <Triangle> right;
            vector <ll> pos;
            for (ll j = 0; j < n; ++j) {
                if (j != i) pos.push_back(j);
            }
            left.push_back(Triangle(pos[0], pos[1], pos[2]));
            right.push_back(Triangle(i, pos[0], pos[1]));
            right.push_back(Triangle(i, pos[0], pos[2]));
            right.push_back(Triangle(i, pos[2], pos[1]));
            ll c = compare(left, right);
            if (c == 0) {
                ind = i;
                break;
            }
        }
        if (ind != -1) {
            vector <ll> pos;
            for (ll i = 0; i < n; ++i) {
                if (i != ind) pos.push_back(i);
            }
            ans.push_back({ind, pos[0], pos[1]});
            ans.push_back({ind, pos[0], pos[2]});
            ans.push_back({ind, pos[2], pos[1]});
        } else {
            ans.push_back({});
            for (ll i = 0; i < n; ++i) {
                for (ll j = 0; j < n; ++j) {
                    if (i != j) {
                        vector <ll> pos;
                        for (ll k = 0; k < n; ++k) {
                            if (k != i && k != j) pos.push_back(k);
                        }
                        ll c = compare({Triangle(i, j, pos[0]), Triangle(i, j, pos[1])}, {Triangle(i, pos[1], pos[0]), Triangle(pos[0], j, pos[1])});
                        if (c == 0) {
                            ans.back() = {i, pos[0], j, pos[1]};
                            break;
                        }
                    }
                }
            }
        }
        return ans;
    }
}