#include<bits/stdc++.h> using namespace std; int vis[205][205]; int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1}; int lf = 100, rt = 100, tp = 100, bm = 100; string comm(string r) { string s; cout << r << endl; cin >> s; return s; } void dfs(int x, int y, int d) { lf = min(lf, x), rt = max(rt, x); tp = min(tp, y), bm = max(bm, y); comm("RIGHT"); for (int dd = 3; dd < 6; dd++) { int fd = (dd + d) % 4; int nx = x + dx[fd], ny = y + dy[fd]; if (vis[nx][ny]) comm("LEFT"); else if (comm("GO") == "FAIL") { vis[nx][ny] = 2; comm("LEFT"); } else { vis[nx][ny] = 1; dfs(nx, ny, fd); comm("GO"); comm("RIGHT"); } } int fd = (2 + d) % 4; int nx = x + dx[fd], ny = y + dy[fd]; if (!vis[nx][ny] and comm("GO") == "SUCC") { vis[nx][ny] = 1; dfs(nx, ny, fd); } } signed main() { while (comm("LEFT") != "N"); vis[100][100] = 1; dfs(100, 100, 0); cout << "END" << endl; cout << rt - lf + 3 << ' ' << bm - tp + 3 << endl; for (int i = lf - 1; i <= rt + 1; i++, cout << endl) for (int j = tp - 1; j <= bm + 1; j++) cout << (vis[i][j] == 1 ? '.' : '#'); }