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

namespace {
    static vector<pair<int, int>> points;
    static vector<int> p;
    static int n;
    static int q;
    static int qt;
}
vector<pair<int, int>> ZapisiTacke(int n)
{
    vector<pair<int, int>> V;
    for(int i = 0; i <= n; i++)
    {
        if(i == 2 or i == n - 1) V.push_back({i, 1});
        else V.push_back({i, 0});
    }
    return V;
};

int sol[1005], manji[1005];

vector<int> Resi(int n, int q)
{
    
    vector<int> V;
    if(N > 50)
    {
        if(Pitaj(1, 2, 3) == -1) for(int i = 0; i <= n; i++) V.push_back(i);
        else for(int i = n + 1; i; i--) V.push_back(i);
    }
    else
    {
        for(int i = 1; i <= n; i++) pos[i] = i;
        if(Pitaj(1, 2, 3) != 0)
        {
            if(Pitaj(1, 4, 5) != 0) idx = 1;
            else if(Pitaj(2, 4, 5) != 0) idx = 2;
            else idx = 1;
        }
        else
        {
            for(int i = 2; i < n - 1; i++)
                if(Pitaj(i, i + 1, i + 2) != 0)
                {
                    idx = i + 2;
                    break;
                }
        }
        for(int i = 1; i <= n; i++)
        {
            if(i == idx) continue;
            for(int j = 1; j <= n; j++)
            {
                if(i == j) continue;
                if(j == idx) continue;
    //            cout << idx << " " << i << " " << j << "\n";
                if(Pitaj(idx, i, j) == -1) manji[i]++;
            }
        }
        for(int i = 1; i <= n; i++) sol[i] = manji[i] + 2;
        V.push_back(0);
        sol[idx]--;
        for(int i = 1; i <= n; i++) V.push_back(sol[i]);
    }
    return V;
};