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. // i is the row, j is the column int rowD = i_start - i_end; int columnD = j_start - j_end; if (rowD % 2 != 0) { System.out.println("Impossible"); return; } ArrayList path = new ArrayList(); //boolean done = false; int posI = i_start; int posJ = j_start; while (true) { if (posI == i_end && posJ == j_end) { //found the target //done = true; break; } if (posI < 0 || posJ < 0 || posI >= n || posJ >= n) { System.out.println("Unintentional error"); return; } if (posJ - 2 == j_end) { //two left if (posI + 2 == i_end || posI - 2 == i_end) { System.out.println("Impossible"); return; } if (posI == i_end) { //add left path.add("L"); posJ -= 2; //move left } else if (posI < i_end) { //target below pos path.add("LL"); posJ -= 1; posI += 2; } else { //target above pos path.add("UL"); posJ -= 1; posI -= 2; } } else if (posJ - 1 == j_end) { //one left if (posI == i_end) { System.out.println("Impossible"); return; } if (posI < i_end) { //go down, increase posI path.add("LL"); posJ -= 1; posI += 2; } else { path.add("UL"); //go up, decrease posI posJ -= 1; posI -= 2; } } else if (posJ == j_end) { //in line if (posI + 2 == i_end || posI - 2 == i_end) { System.out.println("Impossible"); return; } if (posI < i_end) { //go down, increase posI path.add("LR"); posJ += 1; posI += 2; } else { //go up, decrease posI path.add("UL"); posJ -= 1; posI -= 2; } } else if (posJ + 1 == j_end) { //one right if (posI == i_end) { System.out.println("Impossible"); return; } if (posI < i_end) { //go down, increase posI path.add("LR"); posJ += 1; posI += 2; } else { path.add("UR"); //go up, decrease posI posJ += 1; posI -= 2; } } else if (posJ + 2 == j_end) { //two right if (posI + 2 == i_end || posI - 2 == i_end) { System.out.println("Impossible"); return; } if (posI == i_end) { //add right path.add("R"); posJ += 2; //move right } else if (posI < i_end) { //target below pos path.add("LR"); posJ += 1; posI += 2; } else { //target above pos path.add("UR"); posJ += 1; posI -= 2; } } else if (posJ > j_end) { //>two left if (posI == i_end) { path.add("L"); posJ -= 2; } else if (posI < i_end) { //go down, increase posI path.add("LL"); posJ -= 1; posI += 2; } else { //go up, decrease posI path.add("UL"); posJ -= 1; posI -= 2; } } else { //>two right if (posI > i_end) { //go up, decrease posI path.add("UR"); posJ += 1; posI -= 2; } else { path.add("R"); posJ += 2; } } } System.out.println(path.size()); for (String s : path) { System.out.print(s + " "); } } 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(); } }