#!/bin/python3 import sys def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. # Opcion: verificar que parametros dados estén dentro de rango # Saco módulo de 2 entre la diferencia de las posiciones para verificar si es alcanzable dif_i = i_start-i_end modi = dif_i%2 if(modi == 0): #es alcanzable verticalmente, verificamos horizonalmente half_dif_i = dif_i/2 dif_j = j_start - j_end modj= dif_j%2 if(half_dif_i%2 == 0): if(modj == 0): path(dif_i,dif_j) else: print("Impossible") if(half_dif_i%2 == 1): if(modj == 1): path(dif_i,dif_j) else: print("Impossible") else: print("Impossible") def path(i,j): moves = 0 txt = "" # para debugg: print("init: " + str(i) + ", " + str(j)) while(i != 0 or j != 0): # print("UL") if(abs(i-2) < abs(i)): if( j == 0 or abs(j-1) < abs(j)): txt = txt+"UL " moves = moves + 1 i = i-2 j = j-1 continue # print("UR") if(abs(j+1) < abs(j)): txt = txt+"UR " moves = moves + 1 i = i-2 j = j+1 continue # print("R") if(i == 0 or abs(i+2) < abs(i)): if(abs(j+2) < abs(j)): txt = txt+"R " moves = moves + 1 j = j+2 continue # print("LR") if(abs(i+2) < abs(i)): if( j == 0 or abs(j+1) < abs(j)): txt = txt+"LR " moves = moves + 1 i = i+2 j = j+1 continue # print("LL") if(abs(j-1) < abs(j)): txt = txt+"LL " moves = moves + 1 i = i+2 j = j-1 continue # print("L") if(i == 0): if(abs(j-2) < abs(j)): txt = txt+"L " moves = moves + 1 j = j-2 continue print(str(moves)) print(txt) 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)