#!/bin/python3 import sys def printShortestPath(n, i_start, j_start, i_end, j_end): # Calculate horizontal and vertical distances v_dist = abs(i_start-i_end) h_dist = abs(j_start-j_end) # If the destination row is an odd number of rows away from the start row, it is impossible to reach if v_dist % 2 == 1: print('Impossible') return # If the destination row is v away from the source row, the destination column must be (v/2)%2 away from the source column mod 2 if h_dist % 2 != (v_dist//2) % 2: print('Impossible') return # At this point, a path is guaranteed # Create path list result = [] # Make moves until the destination is reached i, j = i_start, j_start while i != i_end or j != j_end: # There are eight possibilities: # 1. The destination is to the upper right # 2. The destination is to the lower right # 3. The destination is to the upper left # 4. The destination is to the lower left # 5. The destination is right # 6. The destination is left # 7. The destination is up # 8. The destination is down # Check each possibility: # Upper right if i > i_end and j < j_end: # Move to the upper right result.append('UR') i -= 2 j += 1 # Lower right elif i < i_end and j < j_end: # Move to the lower right result.append('LR') i += 2 j += 1 # Upper left elif i > i_end and j > j_end: # Move to the upper left result.append('UL') i -= 2 j -= 1 # Lower left elif i < i_end and j > j_end: # Move ot the lower left result.append('LL') i += 2 j -= 1 # Right elif i == i_end and j < j_end: # Move right result.append('R') j += 2 # Left elif i == i_end and j > j_end: # Move left result.append('L') j -= 2 # Up elif i > i_end and j == j_end: # Move upper left, if possible, otherwise move upper right if j > 0: result.append('UL') i -= 2 j -= 1 else: result.append('UR') i -= 2 j += 1 # Down elif i < i_end and j == j_end: # Move lower right, if possible, otherwise move lower left if j < n-1: result.append('LR') i += 2 j += 1 else: result.append('LL') i += 2 j -= 1 # Sort the path according to priorities priority = {'UL':0, 'UR':1, 'R':2, 'LR':3, 'LL':4, 'L':5} result.sort(key = lambda x : priority[x]) # Print the resulting path print(len(result)) print(' '.join(result)) if __name__ == "__main__": n = int(input().strip()) i_start, j_start, i_end, j_end = input().strip().split(' ') i_start, j_start, i_end, j_end = [int(i_start), int(j_start), int(i_end), int(j_end)] printShortestPath(n, i_start, j_start, i_end, j_end)