#include<stdio.h>
#include<vector>
#include<random>
#include<time.h>
#include<algorithm>
#define M 1005
using namespace std;
int n,a[M],b[M],bt,st[M],tp,f[M];
mt19937_64 rnd(time(0));
int find(int x){return x!=f[x]?(f[x]=find(f[x])):x;}
void sol(int l,int r){
if(l>=r) return;
int mid=l+r>>1;bt=0;
for(int i=l;i<=r;++i) b[++bt]=a[i];
shuffle(b+1,b+bt+1,rnd);
tp=bt,memcpy(st,b,(tp+1)<<2);
for(int i=1;i<=bt;++i) f[b[i]]=b[i];
int cl=l,cr=mid+1;
while(tp>1){
int x=st[tp--],y=st[tp--];
printf("0 ");
for(int i=1;i<=mid;++i) printf("%d ",x);
for(int i=mid+1;i<=n;++i) printf("%d ",y);
puts(""),fflush(stdout);
int v;scanf("%d",&v);
if(v==2){
for(int i=1;i<=bt;++i) if(find(b[i])==x) a[cl++]=b[i];
for(int i=1;i<=bt;++i) if(find(b[i])==y) a[cr++]=b[i];
}else if(v==0){
for(int i=1;i<=bt;++i) if(find(b[i])==x) a[cr++]=b[i];
for(int i=1;i<=bt;++i) if(find(b[i])==y) a[cl++]=b[i];
}else st[++tp]=x,f[find(y)]=x;
}
if(tp){
int x=st[tp];
for(int i=1;i<=bt;++i) if(find(b[i])==x){
if(cl<=mid) a[cl++]=b[i];
else a[cr++]=b[i];
}
}
// printf("[%d, %d]: %d %d %d\n",l,r,mid,cl,cr);
// for(int i=l;i<=r;++i) printf("%d ",a[i]);
// puts("");
sol(l,mid),sol(mid+1,r);
}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;++i) a[i]=i;
sol(1,n);
printf("1 ");
for(int i=1;i<=n;++i) printf("%d ",a[i]);
}