#include using namespace std; vector path; int flag=0; void print() { for(int i=0;ii_end)?(i_start-i_end):(i_end-i_start); int y=(j_start>j_end)?(j_start-j_end):(j_end-j_start); int yi=i_start-i_end; int xi=j_start-j_end; if(i_start==i_end&&j_start==j_end) { cout<=1&&yi>=2) { i_start-=2; j_start-=1; steps++; path.push_back("UL "); printShortestPath(n,i_start,j_start,i_end,j_end,steps); } else if(xi<=-1&&yi<=-2) { i_start+=2; j_start+=1; steps++; path.push_back("LR "); printShortestPath(n,i_start,j_start,i_end,j_end,steps); } else if(xi>=1&&yi<=-2) { i_start+=2; j_start-=1; steps++; path.push_back("LL "); printShortestPath(n,i_start,j_start,i_end,j_end,steps); } else if(xi<=-1&&yi>=2) { i_start-=2; j_start+=1; steps++; path.push_back("UR "); printShortestPath(n,i_start,j_start,i_end,j_end,steps); } else if(yi>=2) { if(j_start+1<=n-1) { i_start-=2; j_start+=1; steps++; path.push_back("UR "); printShortestPath(n,i_start,j_start,i_end,j_end,steps); } else { i_start-=2; j_start-=1; steps++; path.push_back("UL "); printShortestPath(n,i_start,j_start,i_end,j_end,steps); } } else if(yi<=-2) { if(j_start+1<=n-1) { i_start+=2; j_start+=1; steps++; path.push_back("LR "); printShortestPath(n,i_start,j_start,i_end,j_end,steps); } else { i_start+=2; j_start-=1; steps++; path.push_back("LL "); printShortestPath(n,i_start,j_start,i_end,j_end,steps); } } else if(xi>=2) { j_start-=2; steps++; path.push_back("L "); printShortestPath(n,i_start,j_start,i_end,j_end,steps); } else if(xi<=-2) { j_start+=2; steps++; path.push_back("R "); printShortestPath(n,i_start,j_start,i_end,j_end,steps); } else if(xi==1||yi==1||xi==-1||yi==-1) { flag=-1; printShortestPath(n,i_start,j_start,i_end,j_end,steps); } } } 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; printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }