#include "triangles.h"

#include <bits/stdc++.h>

using namespace std;



std::vector<std::vector<int>> solve(int n) {
    for (int i = 0; i < 4; i++) {
        vector<int> a;
        for (int j = 0; j < 4; j++) if (j != i) a.push_back(j);
        int res = compare({{cu[a[0]], cu[a[1]], cu[a[2]]}}, {{cu[a[0]], cu[a[1]], cu[i]}, {cu[a[1]], cu[a[2]], cu[i]}, {cu[a[2]], cu[a[0]], cu[i]}});
        if (res == 0) {
            vector<vector<int>> ans = {{cu[a[0]], cu[a[1]], cu[i]}, {cu[a[1]], cu[a[2]], cu[i]}, {cu[a[2]], cu[a[0]], cu[i]}};
            return ans;
        }
    }
    vector<int> por(4);
    for (int i = 0; i < 4; i++) por[i] = i;
    while (true) {
        int res = compare({{cu[por[0]], cu[por[1]], cu[por[3]]}, {cu[por[1]], cu[por[2]], cu[por[3]]}}, {{cu[por[0]], cu[por[1]], cu[por[2]]}, {cu[por[0]], cu[por[2]], cu[por[3]]}});
        if (res == 0) {
            return {{cu[por[0]], cu[por[1]], cu[por[3]]}, {cu[por[1]], cu[por[2]], cu[por[3]]}};
        }
        next_permutation(por.begin(), por.end());
    }
}
