#include "art.h"
#include<bits/stdc++.h>
using namespace std;
//
// --- 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
//
void solve(int n) {
int a[4005],sum=n*(n+1)/2,fans[4005];
vector<int>v,ans;
for(int i=1;i<=n;i++){
v.push_back(i);
}
a[0]=publish(v);
for(int i=1;i<n;i++){
v.clear();
for(int h=i+1;h<=n;h++) v.push_back(h);
for(int h=1;h<=i;h++) v.push_back(h);
a[i]=publish(v);
fans[n-(a[i]-a[i-1]+n+1)/2]=i;
sum-=(n+1-(a[i]-a[i-1]+n+1)/2);
}
// cout<<sum;
fans[sum-1]=n;
for(int i=0;i<n;i++){
ans.push_back(fans[i]);
}
cout<<"\n";
answer(ans);
}