#include "triangles.h"
#include "bits/stdc++.h"
using namespace std;
std::vector<std::vector<int>> solve(int n) {
    vector<Triangle> big = {{0, 1, 2}};
    for (int i = 0; i < 4; ++i) {
        for (int j = i + 1; j < 4; ++j) {
            for (int k = j + 1; k < 4; ++k) {
                vector<Triangle> cur = {{i, j, k}};
                if (compare(big, cur) == -1) {
                    big = cur;
                }
            }
        }
    }
    vector<Triangle> ans = big;
    bool fl = true;
    for (int i = 0; i < 4; ++i) {
        for (int j = i + 1; j < 4; ++j) {
            for (int k = j + 1; k < 4; ++k) {
                for (int x = 0; x < 4; ++x) {
                    for (int y = x + 1; y < 4; ++y) {
                        for (int z = y + 1; z < 4; ++z) {
                            for (int a = 0; a < 4; ++a) {
                                for (int b = a + 1; b < 4; ++b) {
                                    for (int c = b + 1; c < 4; ++c) {
                                        if (vector<int>{i, j, k} == vector<int>{x, y ,z} || vector<int>{i, j, k} == vector<int>{a, b, c} || vector<int>{x, y, z} == vector<int>{a, b, c}) continue;
                                        vector<Triangle> cur = {{i, j, k}, {x, y, z}, {a, b, c}};
                                        int st = compare(big, cur);
                                        if (st == 0) {
                                            ans = cur;
                                            fl = false;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if (fl) {
        for (int i = 0; i < 4; ++i) {
            for (int j = i + 1; j < 4; ++j) {
                for (int k = j + 1; k < 4; ++k) {
                    for (int x = 0; x < 4; ++x) {
                        for (int y = x + 1; y < 4; ++y) {
                            for (int z = y + 1; z < 4; ++z) {
                                vector<Triangle> cur = {{i, j, k}, {x, y, z}};
                                if (vector<int>{i, j, k} == vector<int>{x, y, z}) continue;
                                if ((i == x && j == y || j == y && k == z) &&compare(ans, cur) == -1) {
                                    ans = cur;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    vector<vector<int>> res;
    for (auto x:ans) {
        vector<int> add = {x.i, x.j, x.k};
        res.push_back(add);
    }
    return res;
}