#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define MT make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)<; using vi = vector; using vll = vector; const int DY[] = { -1,0,1,0 }; const int DX[] = { 0,1,0,-1 }; const int INF = 20151224; stack hs; int dir; int order(char c) { if (c == 'R' || c == 'F')hs.push(c); if (c == 'R') (dir += 1) %= 4; else if (c == 'L')(dir += 3) %= 4; cout << c << endl; string res; cin >> res; if (res[0] == 'M') exit(0); return stoi(res); } int A[410][410]; const int OS = 205; void dfs(int y, int x) { if (A[y][x]++)return; while (dir != 3) order('R'); rep(i, 4) { int movable = order('R'); int ny = DY[i] + y; int nx = DX[i] + x; if (!movable)A[ny][nx] = 1; if (!A[ny][nx]) { int stk_size = sz(hs); order('F'); dfs(ny, nx); while (sz(hs) > stk_size) { char c = hs.top(); hs.pop(); if (c == 'R')order('L'); else order('B'); } } } } void solve() { {string s; cin >> s; } dfs(OS, OS); } int main() { // ios::sync_with_stdio(false); // cin.tie(0); cout << fixed << setprecision(15); solve(); return 0; }