#include <bits/stdc++.h>
using namespace std;
#define pause system("pause")
#define cls system("pause");system("cls")
const int maxn=1e5+10;
int ar[100]={0,1,2,3,4,5,6,7,8,9};
string idname[100]={""/*这里是空串*/,"","","","","","",""};
bool mediUse[5]={0,1,1};
int n;
struct node{
int id,deadr=-1;
bool alive=1;
}a[maxn];
bool check(int x){
if(a[x].id==1||a[x].id==2)return 1;
else return 0;
}
int func(int x){
if(x<=2)return 1;
if(x<=n-2)return x-1;
return n-2;
}
bool wolfwin(){
for(int i=1;i<=n;i++){
if(a[i].alive==1&&check(i)==0)return 0;
}
return 1;
}
bool wolflose(){
for(int i=1;i<=n;i++){
if(a[i].alive==0&&check(i)==1)return 0;
}
return 1;
}
int wolfkill(int rd){
cout<<"";//<---------THIS
for(int i=1;i<=n;i++){
if(check(i))cout<<i<<' ';
}
cls;
cout<<"";//<---------THIS
int kil;cin>>kil;
a[kil].alive=0;a[kil].deadr=rd;
return kil;
}
bool medirev(int killed){
if(mediUse[1]==1){
cout<<""<<killed<<" ";//<---------THIS
int rev;cin>>rev;
if(rev==1){
a[killed].alive=1;a[killed].deadr=-1;
return 1;
}
else return 0;
}
else cout<<"";//<---------THIS
}
int medikill(){
cout<<"";
if(mediUse[2]==1){
int kill;cin>>kill;
return kill;
}
}
void night(int rd){
int kd=wolfkill(rd);
cls;
int x;
cin>>x;
cout<<check(x);
cls;
medirev(kd);
int mkd=medikill();
a[mkd].alive=0;a[mkd].deadr=rd;
cls;
}
void morning(int rd){
bool f=0;
for(int i=1;i<=n;i++){
if(a[i].deadr==rd){
f=1;
}
}
if(f==0)cout<<"";//<---------THIS
else {
cout<<"";//<---------THIS
for(int i=1;i<=n;i++){
if(a[i].deadr==rd){
cout<<i<<"";//<---------THIS
}
}
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
srand(time(NULL));
int n;
cin>>n;
random_shuffle(ar+1,ar+n+1);
for(int i=1;i<=n;i++){
a[i].id=func(ar[i]);
cout<<"";//<---------THIS
cls;
}
for(int round=1;;round++){
cout<<"";//<---------THIS
night(round);
morning(round);
if(wolfwin()){
cout<<"";//<---------THIS
cls;
return 0;
}
if(wolflose()){
cout<<"";//<---------THIS
cls;
return 0;
}
}
return 0;
}