#include <iostream> #include <string> #include <iomanip> #include <cstdio> #include <algorithm> #include <set> #include <map> #include <queue> #include <utility> #include <vector> #include <stack> #define L(i, a, b) for (int i = a; i <= b; i++) #define Bk(i, a, b) for (int i = a; i >= b; i--) using namespace std; long long Mi(int a, int b) { long long ans = 1; L(i, 2, b) ans *= b; return ans; } void Solve() { int n, m; char M[350][350]; string Com[3] = {"LEFT", "GO", "RIGHT"}; int dir[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; bool all = false; string command; int x = 1, y = 1; L(i, 0, 300) L(j, 0, 300) M[i][j] = 'x'; M[x][y] = '.'; int minx = x, miny = y, maxx = x, maxy = y, go; int flag = 4; while (true) { if (flag == 0) all = true; string feedback; command = Com[0]; // cout << command << endl; // cin >> feedback; // if (all) { cout << "END" << endl; n = maxy - miny + 3; m = maxx - minx + 3; cout << n << " " << m << endl; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) cout << M[i][j]; cout << endl; } break; // } else { command = Com[1]; cout << command << endl; while (true) { cin >> feedback; if (feedback == "S") go = 0; if (feedback == "E") go = 1; if (feedback == "N") go = 2; if (feedback == "W") go = 3; if (feedback == "FAIL") { M[x + dir[go][0]][y + dir[go][1]] = '#'; flag--; break; } else { M[x + dir[go][0]][y + dir[go][1]] = '.'; x += dir[go][0]; y += dir[go][1]; minx = min(x, minx); miny = min(y, miny); maxx = max(x, maxx); maxy = max(y, maxy); } cout << command << endl; } } } } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t = 1; // cin >> t; while (t--) Solve(); }