#include <bits/stdc++.h>
#include "code.h"
using namespace std;
vector<pair<int, int>> ZapisiTacke(int n)
{
    vector<pair<int,int>> tacke;tacke.push_back({0,0});
    tacke.push_back({0,0});for (int i=1;i<n;i++) tacke.push_back({1,i-1});
    return tacke;
};

#define MAXN 201

int nalevo[MAXN],nadesno[MAXN];

vector<int> Resi(int n, int q)
{
    int levo=0,kolinearno=0;
    for (int i=3;i<n;i++)
    {
        if (Pitaj(1,2,i)==0) kolinearno++;
        else if (Pitaj(1,2,i)==1) levo++;
    }
    int value=Pitaj(1,2,n);
    if (kolinearno==n-3 and value==-1)
    {
        vector<int> perm;perm.push_back(0);
        for (int i=n;i>=1;i--) perm.push_back(i);
        return perm;
    }
    if (levo==n-3 and value==1)
    {
        vector<int> perm;perm.push_back(0);
        for (int i=1;i<=n;i++) perm.push_back(i);
        return perm;
    }
    vector<int> perm;perm.push_back(0);perm.push_back(1);
    for (int i=2;i<=n;i++) perm.push_back(0);
    for (int node=2;node<=n;node++)
    {
        for (int sled=node+1;sled<=n;sled++)
        {
            int sol=Pitaj(1,node,sled);
            if (sol==1) {nadesno[node]++;nalevo[sled]++;}
            else {nalevo[node]++;nadesno[sled]++;}
        }
        perm[node]=nalevo[node]+2;
    }
    return perm;
};