#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int main(){

	char map[6][8],next[6][8];

	for(int row = 0; row < 6; row++){
		for(int col = 0; col < 8; col++){
			map[row][col] = '.';
		}
	}

	map[0][2] = 'r';
	map[0][3] = 'r';
	map[1][2] = 'r';
	map[1][3] = 'r';

	map[2][0] = 'g';
	map[2][1] = 'g';
	map[3][0] = 'g';
	map[3][1] = 'g';

	map[2][2] = 'y';
	map[2][3] = 'y';
	map[3][2] = 'y';
	map[3][3] = 'y';

	map[2][4] = 'b';
	map[2][5] = 'b';
	map[3][4] = 'b';
	map[3][5] = 'b';

	map[2][6] = 'w';
	map[2][7] = 'w';
	map[3][6] = 'w';
	map[3][7] = 'w';

	map[4][2] = 'o';
	map[4][3] = 'o';
	map[5][2] = 'o';
	map[5][3] = 'o';


	for(int row = 0; row < 6; row++){
		for(int col = 0; col < 8; col++){
			next[row][col] = map[row][col];
		}
	}

	char buf[101];
	scanf("%s",buf);

	for(int i = 0; buf[i] != '\0'; i++){

		switch(buf[i]){
		case 'U':
			next[2][2] = map[2][4];
			next[2][3] = map[2][5];

			next[2][4] = map[2][6];
			next[2][5] = map[2][7];

			next[2][6] = map[2][0];
			next[2][7] = map[2][1];

			next[2][0] = map[2][2];
			next[2][1] = map[2][3];

			next[0][2] = map[1][2];
			next[0][3] = map[0][2];
			next[1][2] = map[1][3];
			next[1][3] = map[0][3];

			break;
		case 'F':
			next[1][3] = map[2][1];
			next[1][2] = map[3][1];

			next[2][1] = map[4][2];
			next[3][1] = map[4][3];

			next[4][2] = map[3][4];
			next[4][3] = map[2][4];

			next[3][4] = map[1][3];
			next[2][4] = map[1][2];

			next[2][2] = map[3][2];
			next[2][3] = map[2][2];
			next[3][2] = map[3][3];
			next[3][3] = map[2][3];

			break;
		case 'R':
			next[0][3] = map[2][3];
			next[1][3] = map[3][3];

			next[2][3] = map[4][3];
			next[3][3] = map[5][3];

			next[4][3] = map[3][6];
			next[5][3] = map[2][6];

			next[3][6] = map[0][3];
			next[2][6] = map[1][3];

			next[2][4] = map[3][4];
			next[2][5] = map[2][4];
			next[3][4] = map[3][5];
			next[3][5] = map[2][5];

			break;
		case 'D':
			next[3][5] = map[3][3];
			next[3][4] = map[3][2];

			next[3][3] = map[3][1];
			next[3][2] = map[3][0];

			next[3][1] = map[3][7];
			next[3][0] = map[3][6];

			next[3][7] = map[3][5];
			next[3][6] = map[3][4];

			next[4][2] = map[5][2];
			next[5][2] = map[5][3];
			next[5][3] = map[4][3];
			next[4][3] = map[4][2];

			break;
		case 'B':
			next[0][2] = map[2][5];
			next[0][3] = map[3][5];

			next[2][5] = map[5][3];
			next[3][5] = map[5][2];

			next[5][3] = map[3][0];
			next[5][2] = map[2][0];

			next[3][0] = map[0][2];
			next[2][0] = map[0][3];

			next[2][7] = map[2][6];
			next[2][6] = map[3][6];
			next[3][6] = map[3][7];
			next[3][7] = map[2][7];

			break;
		case 'L':
			next[3][2] = map[1][2];
			next[2][2] = map[0][2];

			next[1][2] = map[2][7];
			next[0][2] = map[3][7];

			next[2][7] = map[5][2];
			next[3][7] = map[4][2];

			next[5][2] = map[3][2];
			next[4][2] = map[2][2];

			next[2][1] = map[2][0];
			next[2][0] = map[3][0];
			next[3][1] = map[2][1];
			next[3][0] = map[3][1];

			break;
		}
		for(int row = 0; row < 6; row++){
			for(int col = 0; col < 8; col++){
				map[row][col] = next[row][col];
			}
		}
	}

	for(int i = 0; i < 6; i++){
		for(int k = 0; k < 8; k++){
			printf("%c",map[i][k]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 3136