#include "triangles.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/hash_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using ll = long long;
constexpr int maxn = 5e5 + 3, mod = 1e9 + 7, inf = 1e9;
constexpr ll big_inf = 1e16;
constexpr __int128_t bnf = 1e30;
mt19937 rng(122);

int rand_int(int l, int r) {
    return uniform_int_distribution<int>(l, r)(rng);
}

vector<vector<int> > solve(int n) {
    vector<int> vt;
    vector<vector<int> > ans;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                for (int l = 0; l < n; l++) {
                    if (l != k && k != i && k != j && l != i && l != j && i != j) {
                        vector<Triangle> left = {Triangle(i, j, k)};
                        vector<Triangle> right = {Triangle(i, j, l)};
                        int cmp = compare(left, right);
                        if (cmp == 1) {
                            right.clear();
                            right = {Triangle(i, k, l), Triangle(k, j, l), Triangle(i, j, l)};
                            cmp = compare(left, right);
                            if (cmp == 0) {
                                ans.push_back({i, k, l});
                                ans.push_back({j, k, l});
                                ans.push_back({i, j, l});
                                return ans;
                            }
                        }
                    }
                }
            }
        }
    }
    vector<Triangle> aa;
    aa.push_back({0, 1, 2});
    aa.push_back({0, 1, 3});
    aa.push_back({1, 2, 3});
    aa.push_back({0, 2, 3});
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                for (int l = 0; l < n; l++) {
                    if (l != k && k != i && k != j && l != i && l != j && i != j) {
                        vector<Triangle> left = {aa[i], aa[j]};
                        vector<Triangle> right = {aa[l], aa[k]};
                        if (compare(left, right) == 0) {
                            ans.push_back({aa[i].i, aa[i].j, aa[i].k});
                            ans.push_back({aa[j].i, aa[j].j, aa[j].k});
                            return ans;
                        }
                    }
                }
            }
        }
    }
    ans.push_back(vector<int>(n));
    for (int i = 0; i < n; ++i) {
        ans[0][i] = i;
    }
    return ans;
}
