#include #include using namespace std; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { string res[100] ; int curr_pos1 = i_start ; int curr_pos2 = j_start ; int flag = 0 ; int count = -1 ; while(curr_pos1 > 0 && curr_pos2 > 0 && curr_pos1 < n && curr_pos2 < n) { if(curr_pos1 > i_end && curr_pos2 > j_end) { curr_pos1 = curr_pos1 - 2 ; curr_pos2 = curr_pos2 - 1 ; count++ ; res[count] = "UL" ; } if(curr_pos1 > i_end && curr_pos2 < j_end) { curr_pos1 = curr_pos1 - 2 ; curr_pos2 = curr_pos2 + 1 ; count++ ; res[count] = "UR" ; } if(curr_pos1 < i_end && curr_pos2 > j_end) { curr_pos1 = curr_pos1 + 2 ; curr_pos2 = curr_pos2 - 1 ; count++ ; res[count] = "LL" ; } if(curr_pos1 < i_end && curr_pos2 < j_end) { curr_pos1 = curr_pos1 + 2 ; curr_pos2 = curr_pos2 + 1 ; count++ ; res[count] = "LR" ; } if(curr_pos1 == i_end && curr_pos2 > j_end) { curr_pos2 = curr_pos2 - 2 ; count++ ; res[count] = "L" ; } if(curr_pos1 < i_end && curr_pos2 == j_end) { curr_pos1 = curr_pos1 + 2 ; count++ ; res[count] = "R" ; } if(curr_pos1 == i_end && curr_pos2 == j_end) { flag = 1 ; break ; } } if(!flag) { cout << "Impossible" ; } cout << count+1 << endl ; for(int i = 0 ; i <= count ; i++) { cout << res[i] << " " ; } } int main() { int n; cin >> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> j_start >> i_end >> j_end; printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }