import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static class Tile{ int x; int y; String prevMove; public Tile(int x, int y) { this.x = x; this.y = y; this.prevMove = null; } public Tile(int x, int y, String prevMove) { this.x = x; this.y = y; this.prevMove = prevMove; } public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public String getPrevMove() { return prevMove; } public void setPrevMove(String prevMove) { this.prevMove = prevMove; } @Override public boolean equals(Object obj) { if(obj instanceof Tile){ Tile o = (Tile) obj; return (this.x == o.getX() && this.y == o.getY()); } return false; } public boolean isValid(int n){ if(this.x < 0 || this.x >=n)return false; if(this.y < 0 || this.y >=n)return false; return true; } @Override public int hashCode() { return Integer.hashCode(this.x + this.y); } } public static String reverseMove(String move){ switch(move){ case "UL": return "LR"; case "UR": return "LL"; case "R": return "L"; case "LR": return "UL"; case "LL": return "UR"; case "L": return "R"; default: return ""; } } 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(); Map parent = new HashMap<>(); Set mark = new HashSet<>(); Queue queue = new LinkedList<>(); Tile start = new Tile(i_start, j_start); Tile end = new Tile(i_end, j_end); queue.add(start); mark.add(start); parent.put(start, null); while(!queue.isEmpty()){ Tile t = queue.poll(); if(t.equals(end)){ end = t; break; } Tile child = null; //UL child = new Tile(t.x-2, t.y-1, "UL"); if(child.isValid(n) && !mark.contains(child)){ mark.add(child); queue.add(child); parent.put(child, t); } //UR child = new Tile(t.x-2, t.y+1, "UR"); if(child.isValid(n) && !mark.contains(child)){ mark.add(child); queue.add(child); parent.put(child, t); } //R child = new Tile(t.x, t.y+2, "R"); if(child.isValid(n) && !mark.contains(child)){ mark.add(child); queue.add(child); parent.put(child, t); } //LR child = new Tile(t.x+2, t.y+1, "LR"); if(child.isValid(n) && !mark.contains(child)){ mark.add(child); queue.add(child); parent.put(child, t); } //LL child = new Tile(t.x+2, t.y-1 , "LL"); if(child.isValid(n) && !mark.contains(child)){ mark.add(child); queue.add(child); parent.put(child, t); } //L child = new Tile(t.x, t.y-2, "L"); if(child.isValid(n) && !mark.contains(child)){ mark.add(child); queue.add(child); parent.put(child, t); } } if(!parent.containsKey(end)){ System.out.println("Impossible"); }else{ Stack path = new Stack<>(); Tile t = end; while(t != null){ path.push(t); t = parent.get(t); } System.out.println(path.size()-1); while(!path.isEmpty()){ Tile tile = path.pop(); if(tile.prevMove != null){ System.out.print(tile.prevMove + " "); } } System.out.println(); } in.close(); } }