#include using namespace std; int command(char c){ cout << c << endl; string s;cin >> s; if( s == "Merry" ){ cin >> s; exit(0); } int n = stoi(s); return n; } int m[100][100]; void dfs(int x,int y,int dir){ if( m[x][y] == 1 )return; m[x][y] = 1; //cerr << x << " " << y << " " << dir << endl; for(int i=0;i<4;i++){ int n = command('L'); if( n == 0 )continue; int ndir = dir+i+1; if( ndir%4 == 0 ){ command('F'); dfs( x+1, y, ndir); command('B'); }else if( ndir%4 == 1 ){ command('F'); dfs( x, y+1, ndir); command('B'); }else if( ndir%4 == 2 ){ command('F'); dfs( x-1, y, ndir); command('B'); }else if( ndir%4 == 3 ){ command('F'); dfs( x, y-1, ndir); command('B'); } } } int main(void){ memset(m,-1,sizeof(m)); string s; cin >> s; int sx = 50, sy = 50; dfs( sx, sy, 0); return 0; }