#include using namespace std; void printShortestPath(long long int n, long long int i_start, long long int j_start, long long int i_end, long long int j_end) { // Print the distance along with the sequence of moves. if((abs(i_start-i_end)%2==1) || (i_start==i_end && abs(j_start-j_end)%2==1)){ cout<<"Impossible"; return; } long long int c=0; queue< pair< pair,long long int > > q; q.push(make_pair(make_pair(i_start,j_start),c)); long long int vis[n][n]; for(long long int i=0;i f = (q.front().first); c = q.front().second; long long int x = f.first; long long int y = f.second; vis[x][y]=1; if(x==i_end && y==j_end){ cout<=0 && y-1>=0 && !vis[x-2][y-1]){ prev[x-2][y-1] = 1; vis[x-2][y-1] = 1; q.push(make_pair(make_pair(x-2,y-1),c+1)); if(x-2 == i_end && y-1 == j_end){ c=c+1; cout<=0 && y+1=0 && y+2=0 && !vis[x+2][y-1]){ prev[x+2][y-1] = 5; vis[x+2][y-1] = 1; q.push(make_pair(make_pair(x+2,y-1),c+1)); if(x+2 == i_end && y-1 == j_end){ c=c+1; cout<=0 && y-2>=0 && !vis[x][y-2]){ prev[x][y-2] = 6; vis[x][y-2] = 1; q.push(make_pair(make_pair(x,y-2),c+1)); if(x == i_end && y-2 == j_end){ c=c+1; cout<ans; long long int x=i_end; long long int y=j_end; for(long long int i=0;i=0;i--){ if(ans[i]==1) cout<<"UL "; else if(ans[i]==2) cout<<"UR "; else if(ans[i]==3) cout<<"R "; else if(ans[i]==4) cout<<"LR "; else if(ans[i]==5) cout<<"LL "; else if(ans[i]==6) cout<<"L "; } return; } int main() { long long int n; cin >> n; long long int i_start; long long int j_start; long long int i_end; long long int j_end; cin >> i_start >> j_start >> i_end >> j_end; printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }