#!/bin/python import sys def pathExists(i_start, j_start, i_end, j_end): i_parity = i_start % 2 j_parity = j_start % 2 if i_end % 2 != i_parity: return False col_cond1 = (abs(i_end - i_start)%4 == 0) and (j_end%2 == j_parity) col_cond2 = ((abs(i_end - i_start)+2)%4 == 0) and ((j_end+1)%2 == j_parity) if col_cond1 or col_cond2: return True return False """ Get new position""" def get_step(i_start, j_start, i_end, j_end): # Trivial case if i_start == i_end and j_start == j_end: return "", i_start, j_start # Constants step = [["UL", "UR"], ["L", "R"], ["LL", "LR"]] DELTA_ROW = 2 DELTA_COL = 1 if i_end < i_start and j_end <= j_start: return "UL", i_start-DELTA_ROW, j_start-DELTA_COL elif i_end < i_start and j_end >= j_start: return "UR", i_start-DELTA_ROW, j_start+DELTA_COL elif i_end > i_start and j_end >= j_start: return "LR", i_start+DELTA_ROW, j_start+DELTA_COL elif i_end > i_start and j_end <= j_start: return "LL", i_start+DELTA_ROW, j_start-DELTA_COL elif i_end == i_start and j_end >= j_start: return "R", i_start, j_start+2*DELTA_COL else: return "L", i_start, j_start-2*DELTA_COL def printShortestPath(n, i_start, j_start, i_end, j_end): if not pathExists(i_start, j_start, i_end, j_end): print "Impossible" return length = 0 path = [] i_new, j_new = i_start, j_start while i_new!=i_end or j_new!=j_end: step, i_new, j_new = get_step(i_new, j_new, i_end, j_end) # Record new step length += 1 path.append(step) print length print " ".join(path) if __name__ == "__main__": n = int(raw_input().strip()) i_start, j_start, i_end, j_end = raw_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)