#include "triangles.h"

#include <bits/stdc++.h>


using ll = long long;
using namespace std;

vector<vector<int>> solve(int n) {
    Triangle nac = Triangle(0, 1, 2);
    while (true) {
        Triangle pref = nac;
        int fl = 0;
        for (int i = 0; i < n; i++) {
            if (i != nac.i && i != nac.j) {
                Triangle vsp = Triangle(nac.i, nac.j, i);
                if (compare({vsp}, {nac}) == 1) {
                    fl = 1;
                    nac = vsp;
                } 
            }
        }
        for (int i = 0; i < n; i++) {
            if (i != nac.k && i != nac.j) {
                Triangle vsp = Triangle(i, nac.j, nac.k);
                if (compare({vsp}, {nac}) == 1) {
                    fl = 1;
                    nac = vsp;
                } 
            }
        }
        for (int i = 0; i < n; i++) {
            if (i != nac.i && i != nac.k) {
                Triangle vsp = Triangle(nac.i, i, nac.k);
                if (compare({vsp}, {nac}) == 1) {
                    fl = 1;
                    nac = vsp;
                } 
            }
        }
        if (fl == 0) {
            return {{nac.i, nac.j, nac.k}};
        }
    }
}