#include<bits/stdc++.h> 
using namespace std;
int main(){
	int all_explored=0;
	vector<vector<string> > maps(104,vector<string>(104)) ;
	int l=0;
	int robot_x=51,robot_y=51;
	while (true) {
		maps[robot_x][robot_y]=".";
		string feedback;
		string command="LEFT"; 
		string command1="RIGHT";
		string go="GO"; 
		string n,s,e,w;
		cout << command << endl; 
		cin >> feedback; 
		if (feedback=="N"){
			cout<<go<<endl;
			cin >> feedback;
			if (feedback=="FAIL"){
				if (maps[robot_x-1][robot_y]=="#"){
					cout << "END" << endl;
					for (int i=0;i<104;i++){
						for(int j=0;j<104;j++){
							cout<<maps[i][j];
						}
						cout<<endl;
					}
					return 0;
				}
				else{
					maps[robot_x-1][robot_y]="#";
				}
			}
			else{
				maps[robot_x-1][robot_y]=".";
				robot_x--;
			}
		}
		else if (feedback=="W"){
			cout<<go<<endl;
			cin >> feedback;
			if (feedback=="FAIL"){
				if (maps[robot_x][robot_y-1]=="#"){
					cout << "END" << endl;
					for (int i=0;i<104;i++){
						for(int j=0;j<104;j++){
							cout<<maps[i][j];
						}
						cout<<endl;
					}
					return 0;
				}
				else{
					maps[robot_x][robot_y-1]="#";
				}
			}
			else{
				maps[robot_x][robot_y-1]=".";
				robot_y--;
			}
		}
		else if (feedback=="E"){
			cout<<go<<endl;
			cin >> feedback;
			if (feedback=="FAIL"){
				if (maps[robot_x+1][robot_y]=="#"){
					cout << "END" << endl;
					for (int i=0;i<104;i++){
						for(int j=0;j<104;j++){
							cout<<maps[i][j];
						}
						cout<<endl;
					}
					return 0;
				}
				else{
					maps[robot_x+1][robot_y]="#";
				}
			}
			else{
				maps[robot_x+1][robot_y]=".";
				robot_x++;
			}
		}
		else if (feedback=="S"){
			cout<<go<<endl;
			cin >> feedback;
			if (feedback=="FAIL"){
				if (maps[robot_x][robot_y+1]=="#"){
					cout << "END" << endl;
					for (int i=0;i<104;i++){
						for(int j=0;j<104;j++){
							cout<<maps[i][j];
						}
						cout<<endl;
					}
					return 0;
				}
				else{
					maps[robot_x][robot_y+1]="#";
				}
			}
			else{
				maps[robot_x][robot_y+1]=".";
				robot_y++;
			}
		}
	}
	return 0;
}