import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static class Point { int row; int col; String turn; Point prev; Point(int x, int y, Point prev, String turn) { this.row = x; this.col = y; this.prev = prev; this.turn = turn; } } static void makeTurn(String turn, Point p, ArrayDeque q, int[][] board) { int newRow, newCol; switch (turn) { case "UL": newRow = p.row - 2; newCol = p.col - 1; break; case "UR": newRow = p.row - 2; newCol = p.col + 1; break; case "R": newRow = p.row; newCol = p.col + 2; break; case "LR": newRow = p.row + 2; newCol = p.col + 1; break; case "LL": newRow = p.row + 2; newCol = p.col - 1; break; case "L": newRow = p.row; newCol = p.col - 2; break; default: throw new RuntimeException("Unsupported command"); } int n = board.length; if (newRow >= 0 && newCol >= 0 && newRow < n && newCol < n) { if (board[newRow][newCol] == 0) { q.addLast(new Point(newRow, newCol, p, turn)); board[newRow][newCol] = board[p.row][p.col] + 1; } } } static void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { int[][] board = new int[n][n]; ArrayDeque q = new ArrayDeque<>(); q.addLast(new Point(i_start, j_start, null, null)); while (!q.isEmpty()) { Point p = q.removeFirst(); if (p.row == i_end && p.col == j_end) { int routeLen = board[p.row][p.col] + 1; System.out.println(routeLen - 1); Point[] route = new Point[routeLen]; int i = routeLen - 1; while (p != null) { route[i--] = p; p = p.prev; } for (i = 1; i < routeLen; i++) { System.out.print(route[i].turn + " "); } return; } // UL makeTurn("UL", p, q, board); // UR makeTurn("UR", p, q, board); // R makeTurn("R", p, q, board); // LR makeTurn("LR", p, q, board); // LL makeTurn("LL", p, q, board); // L makeTurn("L", p, q, board); } System.out.println("Impossible"); } 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(); } }