#include "triangles.h"
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;

vector<vector<int>> solve(int n) {
    vector<int> arr(n, 0);
    vector<vector<int>> arr1(2, vector<int> ());
    for (int i = 0; i < 4; i++) {
        for (int j = i + 1; j < 4; j++) {
            vector<Triangle> arr1;
            vector<Triangle> arr2;
            int i1;
            for (int k = 0; k < n; k++) {
                if (k != i && k != j) {
                    i1 = k;
                }
            }
            int i2;
            for (int k = 0; k < n; k++) {
                if (k != i && k != j && k != i1) {
                    i2 = k;
                }
            }
            arr1.push_back(Triangle(i, j, i2));
            arr1.push_back(Triangle(i, j, i1));
            arr2.push_back(Triangle(i1, j, i2));
            arr2.push_back(Triangle(i2, i, i1));
            if (compare(arr1, arr2) == 0) {
                arr1[0].push_back(i, j, i2);
                arr1[1].push_back(i, j, i1);
                return arr1;
            }
        }
    }
    int x = 0;
    int y = 1;
    int z = 2;
    for (int i = 0; i < n; i++) {
        for (int j = 1; j < n; j++) {
            for (int k = 2; k < n; k++) {
                vector<Triangle> arr1;
                vector<Triangle> arr2;
                arr1.push_back(Triangle(x, y, z));
                arr2.push_back(Triangle(i, j, k));
                int f = compare(arr1, arr2);
                if (f == -1) {
                    x = i;
                    y = j;
                    z = k;
                }
            }
        }
    }
    int t;
    for (int i = 0; i < n; i++) {
        if (i != x && i != y && i != z) {
            t = i;
        }
    }
    arr1.assign(3, vector<int> ());
    arr1[0].push_back(x);
    arr1[0].push_back(y);
    arr1[0].push_back(t);
    arr1[1].push_back(z);
    arr1[1].push_back(y);
    arr1[1].push_back(t);
    arr1[2].push_back(x);
    arr1[2].push_back(z);
    arr1[2].push_back(t);
    return arr1;
}