#include<bits/stdc++.h> using namespace std; char map_[205][205]; int n,m; string get,now,now_dis,prev; int x=100,y=100; bool go(){ if(now_dis=="N"){ if(map_[y-1][x]=='.'){ return 0; } map_[y-1][x]='.'; y--; }else if(now_dis=="E"){ if(map_[y][x+1]=='.'){ return 0; } map_[y][x+1]='.'; x++; }else if(now_dis=="W"){ if(map_[y][x-1]=='.'){ return 0; } map_[y][x-1]='.'; x--; }else{ if(map_[y+1][x]=='.'){ return 0; } map_[y+1][x]='.'; y++; } return 1; } void fail(){ if(now_dis=="N"){ map_[y-1][x]='#'; }else if(now_dis=="E"){ map_[y][x+1]='#'; }else if(now_dis=="W"){ map_[y][x-1]='#'; }else{ map_[y+1][x]='#'; } } void turn(){ cout<<"LEFT"<<endl; cin>>get; now_dis=get; cout<<"LEFT"<<endl; prev="LEFT"; } void back(); int main(){ map_[100][100]='.'; while(get!="N"){ cout<<"LEFT"<<endl; cin>>get; now_dis=get; } cout<<"GO"<<endl; prev="GO"; while(1){ cin>>get; now_dis=get; if(get=="SUCC"){ if(go()){ cout<<"GO"; prev="GO"; continue; }else{ cout<<"LEFT"<<endl; prev="LEFT"; continue; } }else if(get=="FAIL"){ fail(); cout<<"LEFT"<<endl; prev="LEFT"; continue; }else{ if(go()){ cout<<"GO"; prev="GO"; continue; }else{ cout<<"LEFT"<<endl; prev="LEFT"; continue; } } } return 0; }