#include "triangles.h"
#include <bits/stdc++.h>
using namespace std;

Triangle get(int a, int b, int c) {
    return Triangle(a, b, c);
}

bool cmp(Triangle a, Triangle b) {
    auto k = compare({a}, {b});
    if (k == 1) {
        return true;
    }
    return false;
}

std::vector<std::vector<int> > solve(int n) {
    vector<Triangle> t;
    for (int i = 0; i < n; ++i) {
        for (int j = 1; j < n; ++j) {
            for (int k = j + 1; k < n; ++k) {
                t.push_back(get(i, j, k));
            }
        }
    }
    sort(t.begin(), t.end(), cmp);
    int i = t[0].k;
    t.clear();
    for (int j = 0; j < n; ++j) {
        if (j != i) {
            for (int k = 0; k < n; ++k) {
                if (j != k && i != k) {
                    t.push_back(get(i, j, k));
                }
            }
            break;
        }
    }
    sort(t.begin(), t.end(), cmp);
    int j = t[0].k;
    t.clear();
    for (int k = 0; k < n; ++k) {
        if (i != k && j != k) {
            t.push_back(get(i, j, k));
        }
    }
    sort(t.begin(), t.end(), cmp);
    return {{i, j, t[0].k}};
}
