# include <iostream>
# include <vector>
# include <algorithm>
# include <cassert>
using namespace std;
# include "triangles.h"
//# include "grader.cpp"

bool inside(int x)
{
    vector<int> ids;
    for(int i=0;i<4;i++) if(i!=x) ids.push_back(i);

    Triangle S={ids[0],ids[1],ids[2]};
    vector<Triangle> v2;
    for(int i=0;i<3;i++)
    {
        for(int j=i+1;j<3;j++)
        {
            v2.push_back({ids[i],ids[j],x});
        }
    }

    if(compare({S},v2)==0) return true;
    else return false;
}

bool myCompare(vector<Triangle> A, vector<Triangle> B)
{
    int resp=compare(A,B);
    if(resp==0 or resp==-1) return true;
    return false;
}

std::vector<std::vector<int>> solve(int _n)
{

    for(int i=0;i<4;i++)
    {
        if(inside(i))
        {
            vector<int> v;
            for(int j=0;j<4;j++) if(j!=i) v.push_back(j);
            return {v};
        }
    }

    //assert(0);

    Triangle t[4];
    vector<int> t2[4];
    for(int rem=0;rem<4;rem++)
    {
        vector<int> v;
        for(int i=0;i<rem;i++) if(i!=rem) v.push_back(i);
        t[rem]={v[0],v[1],v[2]};
        t2[rem]=v;
    }

    vector<Triangle> S[4]={{},{t[0],t[1]},{t[0],t[2]},{t[0],t[3]}};
    if(myCompare(S[2],S[1]) and myCompare(S[1],S[3])) return {t2[0],t2[1]};
    if(myCompare(S[3],S[1]) and myCompare(S[1],S[2])) return {t2[0],t2[1]};

    if(myCompare(S[1],S[2]) and myCompare(S[2],S[3])) return {t2[0],t2[2]};
    if(myCompare(S[3],S[2]) and myCompare(S[2],S[1])) return {t2[0],t2[2]};

    if(myCompare(S[1],S[3]) and myCompare(S[3],S[2])) return {t2[0],t2[3]};
    if(myCompare(S[2],S[3]) and myCompare(S[3],S[1])) return {t2[0],t2[3]};
}
