#include<bits/stdc++.h> using namespace std; bool vis[300][300]; int dir[4][2]={0,1,1,0,0,-1,-1,0}; string o; int x=120,y=120,maxx,maxy,minx=2100000000,miny=2100000000; void dfs(int a,int b,char f){ if(vis[x][y]){ return; } else{ if(f=='N'){ if(!vis[x-1][y]){ cout<<"GO"<<endl; cin>>o; if(o=="FAIL"){ vis[x-1][y]=1; } else{ vis[x-1][y]=0; minx=min(minx,x-1); dfs(x-1,y,f); } } if(vis[x][y-1]){ cout<<"LEFT"<<endl; cin>>o; f='W'; cout<<"GO"<<endl; cin>>o; if(o=="FAIL"){ vis[x][y-1]=1; } else{ vis[x][y-1]=0; miny=min(miny,y-1); dfs(x,y-1,f); } } if(vis[x][y+1]){ cout<<"RIGHT"<<endl; cin>>o; f='E'; cout<<"GO"<<endl; cin>>o; if(o=="FAIL"){ vis[x][y+1]=1; } else{ vis[x][y+1]=0; maxy=max(maxy,y+1); dfs(x,y+1,f); } } if(vis[x+1][y]){ cout<<"LEFT"<<endl; cin>>o; f='S'; cout<<"GO"<<endl; cin>>o; if(o=="FAIL"){ vis[x+1][y]=1; } else{ vis[x+1][y]=0; maxx=max(maxx,x+1); dfs(x+1,y,f); } } } if(f=='W'){ if(!vis[x][y-1]){ cout<<"GO"<<endl; cin>>o; if(o=="FAIL"){ vis[x][y-1]=1; } else{ vis[x][y-1]=0; miny=min(miny,y-1); dfs(x,y-1,f); } } if(vis[x+1][y]){ cout<<"LEFT"<<endl; cin>>o; f='S'; cout<<"GO"<<endl; cin>>o; if(o=="FAIL"){ vis[x+1][y]=1; } else{ vis[x+1][y]=0; maxx=max(maxx,x+1); dfs(x+1,y,f); } } if(vis[x-1][y]){ cout<<"RIGHT"<<endl; cin>>o; f='N'; cout<<"GO"<<endl; cin>>o; if(o=="FAIL"){ vis[x-1][y]=1; } else{ vis[x-1][y]=0; minx=min(minx,x-1); dfs(x-1,y,f); } } } if(f=='S'){ if(!vis[x+1][y]){ cout<<"GO"<<endl; cin>>o; if(o=="FAIL"){ vis[x+1][y]=1; } else{ vis[x+1][y]=0; maxx=max(maxx,x+1); dfs(x+1,y,f); } } if(vis[x][y+1]){ cout<<"LEFT"<<endl; cin>>o; f='E'; cout<<"GO"<<endl; cin>>o; if(o=="FAIL"){ vis[x][y+1]=1; } else{ vis[x][y+1]=0; maxx=max(maxx,y+1); dfs(x,y+1,f); } } if(vis[x][y-1]){ cout<<"RIGHT"<<endl; cin>>o; f='W'; cout<<"GO"<<endl; cin>>o; if(o=="FAIL"){ vis[x][y-1]=1; } else{ vis[x][y-1]=0; miny=min(miny,y-1); dfs(x,y-1,f); } } } if(f=='E'){ if(!vis[x][y+1]){ cout<<"GO"<<endl; cin>>o; if(o=="FAIL"){ vis[x][y+1]=1; } else{ vis[x][y+1]=0; maxy=max(maxy,y+1); dfs(x,y+1,f); } } if(vis[x-1][y]){ cout<<"LEFT"<<endl; cin>>o; f='N'; cout<<"GO"<<endl; cin>>o; if(o=="FAIL"){ vis[x-1][y]=1; } else{ vis[x-1][y]=0; minx=min(minx,x-1); dfs(x-1,y,f); } } if(vis[x+1][y]){ cout<<"RIGHT"<<endl; cin>>o; f='S'; cout<<"GO"<<endl; cin>>o; if(o=="FAIL"){ vis[x+1][y]=1; } else{ vis[x+1][y]=0; maxx=max(maxx,x+1); dfs(x+1,y,f); } } } } } int main(){ string a=""; char s; cout<<"LEFT"<<endl; cin>>s; maxx=x; maxy=y; minx=x; miny=y; vis[x][y]=0; dfs(x,y,s); for(int i=minx;i<=maxx;i++){ for(int j=miny;j<=maxy;j++){ cout<<vis[i][j]<<" "; } cout<<endl; } return 0; }