#include <iostream>

using namespace std;

/*
	{'.', '.', 'r', 'r', '.', '.', '.', '.'},
	{'.', '.', 'r', 'r', '.', '.', '.', '.'},
	{'g', 'g', 'y', 'y', 'b', 'b', 'w', 'w', 'g', 'g'},
	{'g', 'g', 'y', 'y', 'b', 'b', 'w', 'w'},
	{'.', '.', 'o', 'o', '.', '.', '.', '.'},
	{'.', '.', 'o', 'o', '.', '.', '.', '.'},

*/
char ini_cube[6][8] = {
	{'.', '.', 'r', 'r', '.', '.', '.', '.'},
	{'.', '.', 'r', 'r', '.', '.', '.', '.'},
	{'g', 'g', 'y', 'y', 'b', 'b', 'w', 'w'},
	{'g', 'g', 'y', 'y', 'b', 'b', 'w', 'w'},
	{'.', '.', 'o', 'o', '.', '.', '.', '.'},
	{'.', '.', 'o', 'o', '.', '.', '.', '.'},
};

char cube[6][8];
char nxt_cube[6][8];

string s;

string Rotate(char c) {
	for (int i=0; i<6; i++) for (int j=0; j<8; j++) nxt_cube[i][j] = cube[i][j];
	
	if (c=='F') {
		nxt_cube[2][2] = cube[3][2]; nxt_cube[2][3] = cube[2][2]; nxt_cube[3][3] = cube[2][3]; nxt_cube[3][2] = cube[3][3];
		nxt_cube[1][2] = cube[3][1]; nxt_cube[1][3] = cube[2][1]; nxt_cube[2][4] = cube[1][2]; nxt_cube[3][4] = cube[1][3];
		nxt_cube[4][3] = cube[2][4]; nxt_cube[4][2] = cube[3][4]; nxt_cube[2][1] = cube[4][2]; nxt_cube[3][1] = cube[4][3];
	}
	if (c=='D') {
		nxt_cube[4][2] = cube[5][2]; nxt_cube[4][3] = cube[4][2]; nxt_cube[5][3] = cube[4][3]; nxt_cube[5][2] = cube[5][3];
		nxt_cube[3][2] = cube[3][0]; nxt_cube[3][3] = cube[3][1]; nxt_cube[3][4] = cube[3][2]; nxt_cube[3][5] = cube[3][3];
		nxt_cube[3][6] = cube[3][4]; nxt_cube[3][7] = cube[3][5]; nxt_cube[3][0] = cube[3][6]; nxt_cube[3][1] = cube[3][7];
	}
	if (c=='R') {
		nxt_cube[2][4] = cube[3][4]; nxt_cube[2][5] = cube[2][4]; nxt_cube[3][5] = cube[2][5]; nxt_cube[3][4] = cube[3][5];
		nxt_cube[1][3] = cube[3][3]; nxt_cube[0][3] = cube[2][3]; nxt_cube[2][6] = cube[1][3]; nxt_cube[3][6] = cube[0][3];
		nxt_cube[4][3] = cube[3][6]; nxt_cube[5][3] = cube[2][6]; nxt_cube[2][3] = cube[4][3]; nxt_cube[3][3] = cube[5][3];
	}
	if (c=='L') {
		nxt_cube[2][0] = cube[3][0]; nxt_cube[2][1] = cube[2][0]; nxt_cube[3][1] = cube[2][1]; nxt_cube[3][0] = cube[3][1];
		nxt_cube[0][2] = cube[3][7]; nxt_cube[1][2] = cube[2][7]; nxt_cube[2][2] = cube[0][2]; nxt_cube[3][2] = cube[1][2];
		nxt_cube[5][2] = cube[3][2]; nxt_cube[4][2] = cube[2][2]; nxt_cube[2][7] = cube[5][2]; nxt_cube[3][7] = cube[4][2];
	}
	if (c=='U') {
		nxt_cube[0][2] = cube[1][2]; nxt_cube[0][3] = cube[0][2]; nxt_cube[1][3] = cube[0][3]; nxt_cube[1][2] = cube[1][3];
		nxt_cube[2][7] = cube[2][1]; nxt_cube[2][6] = cube[2][0]; nxt_cube[2][5] = cube[2][7]; nxt_cube[2][4] = cube[2][6];
		nxt_cube[2][2] = cube[2][4]; nxt_cube[2][3] = cube[2][5]; nxt_cube[2][0] = cube[2][2]; nxt_cube[2][1] = cube[2][3];
	}
	if (c=='B') {
		nxt_cube[2][6] = cube[3][6]; nxt_cube[2][7] = cube[2][6]; nxt_cube[3][7] = cube[2][7]; nxt_cube[3][6] = cube[3][7];
		nxt_cube[0][3] = cube[3][5]; nxt_cube[0][2] = cube[2][5]; nxt_cube[2][0] = cube[0][3]; nxt_cube[3][0] = cube[0][2];
		nxt_cube[5][3] = cube[3][0]; nxt_cube[5][2] = cube[2][0]; nxt_cube[2][5] = cube[5][3]; nxt_cube[3][5] = cube[5][2];
	}
	
	for (int i=0; i<6; i++) for (int j=0; j<8; j++) cube[i][j] = nxt_cube[i][j];
	
	return "I hate harassment.";
}

void print_cube() {
	for (int i=0; i<6; i++) {
		for (int j=0; j<8; j++) {
			cout << cube[i][j];
		}
		cout << endl;
	}
}

int main() {
	for (int i=0; i<6; i++) for (int j=0; j<8; j++) cube[i][j] = ini_cube[i][j];
	cin >> s;
	
	for (int i=0; i<(int)s.size(); i++) Rotate(s[i]);
	
	print_cube();
	
	return 0;
}

Measured memory_bytes: 1192