#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #define rbufsize 65536 #define rd_getc() ({if(rpos>=rend){usleep(1000);rpos=0;rend=read(0,rbuf,rbufsize);dprintf(2,"rend=%d\n",rend);}rbuf[rpos++];}) #define rd() ({int _v=0,_c;while(_c=rd_getc()-48,_c>=0)_v=_v*10+_c;_v;}) #define wt(v) {unsigned _z=v,_n=0;long _d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(long*)wp=_d;wp+=_n;} #define rep(v,e) for(typeof(e)v=0;v>1){ *wp++='?'; *wp++=' '; wt(i*2+1); *wp++=' '; wt(n); *wp++=' '; wt(i*2+2); *wp++=' '; wt(n); *wp++='\n'; } write(1,wbuf,wp-wbuf); rep(i,n>>1){ if(rd_getc()&1){ a[i]=i*2+1; b[i]=i*2+2; }else{ a[i]=i*2+2; b[i]=i*2+1; } rd_getc(); } } for(int m=n>>1;m>1;m=m+1>>1){ char*wp=wbuf; rep(i,m>>1){ *wp++='?'; *wp++=' '; wt(a[i*2+0]); *wp++=' '; wt(a[i*2+0]); *wp++=' '; wt(a[i*2+1]); *wp++=' '; wt(a[i*2+1]); *wp++='\n'; } rep(i,m>>1){ *wp++='?'; *wp++=' '; wt(b[i*2+0]); *wp++=' '; wt(n); *wp++=' '; wt(b[i*2+1]); *wp++=' '; wt(n); *wp++='\n'; } write(1,wbuf,wp-wbuf); rep(i,m>>1){ if(rd_getc()&1){ a[i]=a[i*2+0]; }else{ a[i]=a[i*2+1]; } rd_getc(); } rep(i,m>>1){ if(rd_getc()&1){ b[i]=b[i*2+1]; }else{ b[i]=b[i*2+0]; } rd_getc(); } a[m>>1]=a[m-1]; b[m>>1]=b[m-1]; } { char*wp=wbuf; *wp++='!'; *wp++=' '; wt(a[0]); *wp++=' '; wt(a[0]); *wp++=' '; wt(b[0]); *wp++=' '; wt(n); *wp++='\n'; write(1,wbuf,wp-wbuf); } _exit(0); }