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

using namespace std;

vector <vector <int>> solve(int n) {
    vector<Triangle> T1 = {Triangle(0, 1, 2)};
    vector<Triangle> T2 = {Triangle(0, 1, 3)};
    vector<Triangle> T3 = {Triangle(0, 2, 3)};
    vector<Triangle> T4 = {Triangle(1, 2, 3)};
    int res = compare(T1, T2);
    if (res == -1) swap(T1, T2);
    res = compare(T1, T3);
    if (res == -1) swap(T1, T3);
    res = compare(T1, T4);
    if (res == -1) swap(T1, T4);
    set <int> s = {0,1,2,3};
    auto [i,j,k] = T1[0];
    s.erase(i);
    s.erase(j);
    s.erase(k);
    int ost = *s.begin();
    vector <Triangle> ans = {{i,j,ost}, {i,k,ost}, {j,k,ost}};
    if (compare(ans, T1) == 0) return {{i,j,ost}, {i,k,ost}, {j,k,ost}};
    vector <Triangle> p1 = {{i,j,ost}, T1[0]};
    vector <Triangle> p2 = {{i,k,ost}, T1[0]};
    vector <Triangle> p3 = {{j,k,ost}, T1[0]};
    res = compare(p1, p2);
    if (res == 1) swap(p1, p2);
    res = compare(p1, p3);
    if (res == 1) swap(p1, p3);
    return{{p1[0].i, p1[0].j, p1[0].k}, {p1[1].i, p1[1].j, p1[1].k}};
}