#include <iostream>
#include <array>
#include <string>
using namespace std;

#define ROW 3
#define COL 3


// Allowed = 0 
// Not Allowed = 1
//const int grid[ROW][COL] = {0}; 

array<array<int, ROW>, COL> grid = {{
	{0,0,0},
	{1,0,0}, 
	{0,1,0}
}}; 

string to_str(const array<array<int, ROW>, COL>& g)
{
	string res=""; 
	for(int i=0; i<ROW; ++i)
	{
		for(int j=0; j<COL; ++j)
		{
			res += (j==0)?"":" " + to_string(g[i][j]); 
		}
		res += "\n"; 
	}
	return res; 
}



/**
  * @brief Solving the maze requires finding only 1 path 
  * @note CONSTRAINTS 
  * 1) Bounds 
  * 2) Allowed Cells 
  * 3) Ending Condition 
  */
string solve_maze(const array<array<int, ROW>, COL>& g, const unsigned int r, const unsigned int c, const string& s)
{
	// Ending Condition 
	if((r==(ROW-1)) && (c==(COL-1))) return s; 
	
	// Only 2 steps possible: r+1 or c+1
	// Check Bounds first and allowed second 
	if( ((r+1)<ROW) && (g[r+1][c] == 0) ) {auto res = solve_maze(g, r+1, c, s + (s==""?"":",") + "D"); if(res!="") return res;} 
	if( ((c+1)<COL) && (g[r][c+1] == 0) ) {auto res = solve_maze(g, r, c+1, s + (s==""?"":",") + "R"); if(res!="") return res;} 
	return ""; 
}


/**
  * @brief Decorates the actual engine 
  */
string solve_maze(const array<array<int, ROW>, COL>& g)
{
	auto res = solve_maze(g, 0,0, ""); 
	if (res=="") return "Impossibile to solve"; 
	return res; 
}

int main() {
	// your code goes here
	//cout << to_str(grid) << endl; 
	cout << solve_maze(grid) << endl; 
	return 0;
}