#include<bits/stdc++.h>
using namespace std;
int main(){
	char co;
}while (true) {    
    string fi;
    cin>>co;  // 
    
	cout << co << endl;  //     
	cin >> fi;
	if(co=="LEFT")
	if(co=="RIGHT")
	if(co=="GO SCSS")
	if(co=="GO FRLK") // 
    if (all_explored) {  //         
	cout << "END" << endl;        
	cout << n << " " << m << endl;        
	for (int i = 0; i < n; i++) {            
	for (int j = 0; j < m; j++) {                
	cout << map[i][j];            }            
	cout << endl;        } 
	break; //    
	} else {        
	  continue;//     
	}
}