#include "triangles.h"

bool check(int d, int n) {
    for (int a = 0; a < n; a++) {
        for (int b = 0; b < n; b++) {
            if (a == b) continue;
            for (int c = 0; c < n; c++) {
                if (a == c || b == c) continue;
                if (a == d || b == d || c == d) continue;
                if (compare({Triangle{a, b, d}, Triangle{c, b, d}, Triangle{a, c, d}}, {Triangle{a, b, c}}) == 0) {
                    return false;
                }
            }
        }
    }      
    return true;
}
std::vector<std::vector<int>> solve(int n) {
    if (n == 4) {
        for (int a = 0; a < 4; a++) {
            for (int b = 0; b < 4; b++) {
                if (a == b) continue;
                for (int c = 0; c < 4; c++) {
                    if (a == c || b == c) continue;
                    for (int d = 0; d < 4; d++) {
                        if (a == d || b == d || c == d) continue;
                        if (compare({Triangle{a, b, c}, Triangle{b, c, d}}, {Triangle{a, c, d}, Triangle{b, a, d}}) == 0) {
                            return {{a, b, c}, {b, c, d}};
                        }
                        if (compare({Triangle{a, b, d}, Triangle{c, b, d}, Triangle{a, c, d}}, {Triangle{a, b, c}}) == 0) {
                            return {{a, b, d}, {b, c, d}, {a, c, d}};
                        }
                    }
                }
            }
        }
        return {};
    }
    std::vector<int> answer;
    for (int a = 0; a < n && answer.size() < 3; a++) {
        if (check(a, n)) {
            answer.push_back(a);
        }
    }
    

    return {answer};
}
