#include <bits/stdc++.h>
#include "code.h"

using namespace std;

vector<pair<int, int>> ZapisiTacke(int N){
    vector<pair<int, int>> tacke(N+1);

    tacke[1]={1, 1};
    for(int i = 2; i <= N; i++){
        tacke[i]={-i+2, 0};
    }

    return tacke;
}




vector<int> Resi(int N, int Q){

int diff = -1;

    vector<int> resenje(N+1, 0);
    for(int i = 1; i <= N; i++) resenje[i]=i;
    int c0 = 0;
    int cn = 0;
    for(int i = 3; i <= N; i++){
        int res = Pitaj(1, 2, i);
        if(res==0) c0++;
        else{
            cn++;
            diff = i;
        }

    }
    if(cn>1){
        int res = Pitaj(1, 3, 4);
        if(res!=0) diff = 1;
        else diff = 2;
    }

    for(int i = 1; i <= N; i++){
        if(i==diff) continue;
        int cnt = 0;
        for(int j = 1; j <= N; j++){
            if(j==diff || i==j) continue;
            if(Pitaj(i, diff, j)==-1) cnt++;
        }
        resenje[i]=cnt+2;
    }
    resenje[diff]=1;

    return resenje;
}