#include #include #include #include #include #include #include int a; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end, int a, int b, char* s) { if((i_start==i_end)&&(j_start==j_end)) { printf("%d\n",a); goto label; } else if(((i_start>i_end)&&(j_start>j_end))||((i_start>i_end)&&(j_start==j_end))) { a++; i_start-=2;j_start-=1; *(s+b) = 'U'; b++; *(s+b) = 'L'; b++; *(s+b) = ' '; b++; printShortestPath(n, i_start, j_start, i_end, j_end, a, b, s); } else if((i_start>i_end)&&(j_startj_end)) { a++; i_start+=2;j_start-=1; *(s+b) = 'L'; b++; *(s+b) = 'L'; b++; *(s+b) = ' '; b++; printShortestPath(n, i_start, j_start, i_end, j_end, a, b, s); } else { a++; j_start-=2; *(s+b) = 'L'; b++; *(s+b) = ' '; b++; printShortestPath(n, i_start, j_start, i_end, j_end, a, b, s); } label: n=0; } int main() { int n; scanf("%i", &n); int i_start; int j_start; int i_end; int j_end; scanf("%i %i %i %i", &i_start, &j_start, &i_end, &j_end); i_start+=1;j_start+=1;i_end+=1;j_end+=1; int b,c,d; a=i_start%2; b=i_end%2; c=i_start-i_end;c=abs(c);c=c/2;c=c%2; d=j_start-j_end;d=abs(d);d=d%2; if(a!=b || c!=d) {printf("Impossible\n");} else{ a=0;b=0;c=200; char *s = malloc(sizeof(char) * c); printShortestPath(n, i_start, j_start, i_end, j_end, a, b, s); b--; *(s+b) = '\0'; printf("%s",s); } return 0; }