import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves. int drow = i_start - i_end; int dcol = j_start - j_end; boolean possible = true; if(drow %2 != 0){ possible = false; } else { // drow wel 2 if(drow % 4 == 0 ){ if(dcol %2 != 0){ possible = false; } } else { if(dcol %2 == 0){ possible = false; } } } if(!possible){ System.out.println("Impossible"); } else { //int drowAbs = Math.abs(drow); //int dcolAbs = Math.abs(dcol); //int nrOfMoves = (int) (drowAbs/2 + Math.max(0, dcolAbs - drowAbs/2)/2); int nrOfMoves = 0; String movesString = ""; //System.out.println(nrOfMoves); int i_current = i_start; int j_current = j_start; String move = "start"; while((i_current - i_end != 0) || (j_current - j_end != 0)){ //UL, UR, R, LR, LL, L nrOfMoves += 1; if(i_current > i_end){ // eerst omhoog mogelijk? // eerst UL if(j_current > j_end - (i_current - i_end)/2 && j_current >0 ){// >0: not too far left, off the board! move = "UL"; i_current -= 2; j_current -= 1; } else { move = "UR"; i_current -= 2; j_current += 1; } } else if (i_current == i_end){ // ben je al in de goede rij? dan recht naar links of rechts. moet kunnen toch if(j_current > j_end){ move = "L"; j_current -= 2; } else if (j_current < j_end){ move = "R"; j_current += 2; } } else if (i_current < i_end){ // eerst ff kijken of je naar rechts kan if(j_current < j_end - (i_end - i_current)/2 ){ move = "R"; j_current += 2; } else if ( j_current < (j_end + (i_end - i_current)/2 ) && j_current < n-1 ){ // down down down! < n-1: not too far right! move = "LR"; i_current += 2; j_current += 1; } else { move = "LL"; i_current += 2; j_current -= 1; } } movesString = movesString + move + " "; } System.out.println(nrOfMoves); System.out.println(movesString); } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int i_start = in.nextInt(); int j_start = in.nextInt(); int i_end = in.nextInt(); int j_end = in.nextInt(); printShortestPath(n, i_start, j_start, i_end, j_end); in.close(); } }