#include using namespace std; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves.x=i,j=y int ydif=i_end-i_start,xdif=j_end-j_start; if(abs(ydif)%2==1 || (abs(xdif)-abs(ydif)/2)%2==1){//case where impossible cout << "Impossible"; } else{ cout<<(abs(ydif/2) + min(abs(xdif/2),abs(abs(xdif)-abs(ydif/2))/2))<0){//target right if(ydif<0){//target up cout<<"UR "; xdif-=1; ydif+=2; } else if(xdif>1 && ydif0){ cout<<"LR "; xdif-=1; ydif-=2; } else{ cout<<"R "; xdif-=2; } } else if(xdif<0){//target left if(ydif<0){//target up cout<<"UL "; xdif+=1; ydif+=2; } else if(ydif>0){ cout<<"LL "; xdif+=1; ydif-=2; } else{ cout<<"L "; xdif+=2; } } else if(xdif==0){//target in line vertically if(ydif<0 && j_start>0){//target up cout<<"UL "; xdif+=1; ydif+=2; } else if(ydif<0 && j_start==0){ cout<<"UR "; xdif-=1; ydif+=2; } else if(ydif>0 && j_start<(n-1)){ cout<<"LR "; xdif-=1; ydif-=2; } else if(ydif>0 && j_start==(n-1)){ cout<<"LL "; xdif+=1; ydif-=2; } else{ cout<<"R "; xdif-=2; } } } } } int main() { int n; cin >> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> j_start >> i_end >> j_end; if(i_start>=n || j_start>=n || i_end>=n || j_end>=n || i_start<0 || j_start<0 || i_end<0 || j_end<0){ cout << "Impossible"; } else{ printShortestPath(n, i_start, j_start, i_end, j_end); } return 0; }