#include <bits/stdc++.h> using namespace std; bool b[105][105]; char a[105][105]; char fx; string jg; int n=50,ans,m=50,x=50,y=50,o=50,p=50; int main() { for(int i=1;i<=100;i++) for(int j=1;j<=100;j++) a[i][j]='#'; a[x][y]='.'; while(true) { if(b[x][y]&&ans>=4) { cout<<"END"<<endl; cout<<n-o+1<<" "<<m-p+1<<endl; for(int i=o;i<=n;i++) { for(int j=p;j<=m;j++) cout<<a[i][j]; cout<<endl; } break; } else { cout<<"LEFT"<<endl; cin>>fx; cout<<"GO"<<endl; cin>>jg; if(jg=="FAIL") { ans++; if(fx=='E') a[x][y+1]='#',m++; else if(fx=='W') a[x][y-1]='#',p--; else if(fx=='S') a[x+1][y]='#',n++; else a[x-1][y]='#',o--; } else { b[x][y]=1; if(fx=='E') a[x][y+1]='.',m++,y++; else if(fx=='W') a[x][y-1]='.',y--,p--; else if(fx=='S') a[x+1][y]='.',x++,n++; else a[x-1][y]='.',x--,o--; while(jg=="SUCC") { cout<<"GO"<<endl; cin>>jg; if(jg=="FAIL") break; if(b[x][y]==1) break; b[x][y]=1; if(fx=='E') a[x][y+1]='.',m++,y++; else if(fx=='W') a[x][y-1]='.',y--,p--; else if(fx=='S') a[x+1][y]='.',x++,n++; else a[x-1][y]='.',x--,o--; } if(b[x][y]==1) continue; ans++; if(fx=='E') a[x][y+1]='#',m++; else if(fx=='W') a[x][y-1]='#',p--; else if(fx=='S') a[x+1][y]='#',n++; else a[x-1][y]='#',o--; } } } return 0; }