#include <bits/stdc++.h>
#include "triangles.h"
// #define int long long
// #define all(x) x.begin(), x.end()
// #define rall(x) x.rbegin(), x.rend()
// #define ff first
// #define ss second

using namespace std;

mt19937 rnd(37);

vector <vector <int>> solve(int n) {
    int st = 0;
    bool f = false;
    for (int i = 0; i < n; ++i) {
        vector <Triangle> a;
        vector <Triangle> b;
        vector <int> t;
        for (int j = 0; j < n; ++j) {
            if (j != i) {
                t.push_back(j);
            }
        }
        b = {Triangle(t[0], t[1], t[2])};
        a = {Triangle(t[0], t[1], i), Triangle(t[0], t[2], i), Triangle(t[2], t[1], i)};
        int d = compare(a, b);
        if (d == 0) {
            st = i;
            f = true;
            break;
        }
    }
    if (f) {
        vector <int> t;
        for (int i = 0; i < n; ++i) {
            if (i != st) t.push_back(i);
        }
        return {{st, t[0], t[1]}, {st, t[0], t[2]}, {st, t[1], t[2]}};
    } else {
        for (int i = 0; i < n; ++i) {
            for (int j = i + 1; j < n; ++j) {
                vector <int> p;
                for (int k = 0; k < n; ++k) {
                    if (k != i && k != j) p.push_back(k);
                }
                vector <Triangle> a = {Triangle(p[0], i, j), Triangle(p[1], i, j)};
                vector <Triangle> b = {Triangle(p[0], p[1], j), Triangle(p[1], i, [0])};
                if (compare(a, b) == 0) {
                    return {{p[0], i, j}, {p[1], i, j}};
                }
            }
        }
    }
}

// signed main() {
//     ios_base::sync_with_stdio(0);
//     cin.tie(0);
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
//     int t = 1;
//     while (t--) solve(), cout << '\n';
// }