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

#define ll long long
using namespace std;

vector<vector<int> > solve(int n) {
    ll i, j, l, k;
    vector<Triangle> left, right;
    vector<vector<int> > ans;
    for (i = 0; i < n; i++) {
        left.clear();
        right.clear();
        for (j = 0; j < n; j++) {
            for (l = 0; l < n; l++) {
                for (k = 0; k < n; k++) {
                    if (i == j || i == l || i == k || j == l || j == k || l == k)continue;
                    left = {Triangle(j, l, k)};
                }
            }
        }
        for (j = 0; j < n; j++) {
            if (j == i)continue;
            for (l = j + 1; l < n; l++) {
                if (l == i)continue;
                right.push_back(Triangle(i, j, l));
            }
        }
        ll x = compare(left, right);
        if (x == 0) {
            for (auto u: right) {
                ans.push_back({});
                ans.back().push_back(u.i);
                ans.back().push_back(u.j);
                ans.back().push_back(u.k);
            }
            return ans;
        }
    }
    left = {Triangle(0,1,2),Triangle(0,1,3)};
    right = {Triangle(2,3,0),Triangle(2,3,1)};
    ll x = compare(left, right);
    if (x==0) {
        return {{0,1,2},{0,1,3}};
    }
    left = {Triangle(0,2,1),Triangle(0,2,3)};
    right = {Triangle(1,3,0),Triangle(1,3,2)};
    x = compare(left, right);
    if (x==0) {
        return {{0,2,3},{0,2,1}};
    }
    return {{0,3,1},{0,3,2}};
}
