#include <bits/stdc++.h>
using namespace std;

map <char,pair <int,int> > d;
char mp[105][105],last;
int x,y,n1,n2,m1,m2;
string feedback,command;
bool vis[105][105],r;

void init() {
	d['E'] = {0,1};
	d['W'] = {0,-1};
	d['S'] = {1,0};
	d['N'] = {-1,0};
	x = y = 50;
	mp[50][50] = '.';
	vis[50][50] = 1;
	command = "LEFT";
	return;
}

void set_nm() {
	for (int i = 1;i < 101;i++) {
		for (int j = 1;j < 101;j++) {
			if (vis[i][j]) {
				if (!n2) n2 = i;
				if (!m2) m2 = j;
				if (i > n1) n1 = i;
				if (j > m1) m1 = j;
				if (i < n2) n2 = i;
				if (j < m2) m2 = j;
			}
		}
	}
	return;
}

void all_explored() {
	cout << "END" << endl;
	cout << n1 - n2 + 1 << " " << m1 - m2 + 1 << endl;
	for (int i = n2; i <= n1; i++) {
		for (int j = m2; j <= m1; j++) {
			if (!vis[i][j]) {
				cout << '#';
				continue;
			}
			cout << mp[i][j];
		}
		cout << endl;
	}
	return;
}

int main() {
	init();
	while (1) {
		cout << command << endl;
		if (command == "LEFT" || command == "RIGHT") {
			cin >> feedback;
			last = feedback[0];
			command = "GO";
		} else {
			cin >> feedback;
			int nx = x + d[last].first;
			int ny = y + d[last].second;
			if (feedback[0] == 'S') {
				mp[nx][ny] = '.';
				if (vis[x][y]) r = ~r;
				command = "GO";
				x = nx;
				y = ny;
			} else {
				mp[nx][ny] = '#';
				if (r) command = "RIGHT";
				else command = "LEFT";
			}
			vis[nx][ny] = 1;
		}
		if (vis[x + 1][y] && vis[x - 1][y] && vis[x][y - 1] && vis[x][y + 1]) {
			set_nm();
			all_explored();
			return 0; 
		}
	}
	return 0;
}