#include "art.h"
//
// --- Sample implementation for the task art ---
//
// To compile this program with the sample grader, place:
// art.h art_sample.cpp sample_grader.cpp
// in a single folder, then open the terminal in this directory (right-click onto an empty spot in the directory,
// left click on "Open in terminal") and enter e.g.:
// g++ -std=c++17 art_sample.cpp sample_grader.cpp
// in this folder. This will create a file a.out in the current directory which you can execute from the terminal
// as ./a.out
// See task statement or sample_grader.cpp for the input specification
//
//Segment Tree is a State of Mind
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr<<#x<<" is "<<x<<endl;
#define debugp(x,y) cerr<<#x<<' '<<#y<<" is "<<x<<' '<<y<<endl;
#define debugl(x) cerr<<#x<<" is ";for(auto p:x)cerr<<p<<" ";cerr<<endl;
#define debugpl(x) cerr<<#x<<" is ";for(auto p:x)cerr<<p.first<<" "<<p.second<<" , ";cerr<<endl;
//#define int long long
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pii> ipii;
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define rdint(x,y) rnd()%(y-x+1)+x
//const int inf=4e18+5;
const int mod=1e9+7;
const int mod2=998244353;
const int mod3=1e9+9;
const int maxn=1e5+5;
void solve(int N) {
vi v;
int n=N;
for(int i=1;i<=N;i++)v.pb(N-i+1);
vi res;
vector<pii> d(n+1);
int ret=publish(v);
res.pb(ret);
for(int i=1;i<n;i++){
v.clear();
for(int j=n-1;j>=0;j--){
v.pb((j+i)%n+1);
}
ret=publish(v);
res.pb(ret);
}
res.pb(res[0]);
//debugl(res)
d[0]={-mod,0};
for(int i=1;i<=n;i++){
d[i]={res[i]-res[i-1],i};
}
sort(d.begin(),d.end());
// debugpl(d)
vi ans;
for(int i=1;i<=n;i++)ans.pb(d[i].se);
answer(ans);
}