#include #include #include #include #include #include #include char ch[200]; void printShortestPath(int n, int rs, int cs, int re,int ce) { int x=0,i=0; if(abs(rs-re)%2!=0)printf("Impossible"); else if((abs(cs-ce)%2!=1)&&cs!=ce) printf("Impossible"); else if(abs(cs-ce)%2!=0&&cs==ce) printf("Impossible"); else{ if(rs-re>0&&cs-ce<0) { while(1) { if(rs-2>=re&&cs+1=re&&cs+10) { while(3) { if(rs+2<=re&&cs-1>ce){rs+=2;cs-=1;x++;ch[i++]=' ';ch[i++]='L';ch[i++]='L';} if(rs==re){cs-=2;x++;ch[i++]=' ';ch[i++]='L';} if(rs==re&&cs==ce)break; } } else if(rs-re>0&&cs-ce>0) { while(4) { if(rs-2>=re&&cs-1>ce){rs-=2;cs-=1;x++;ch[i++]=' ';ch[i++]='U';ch[i++]='L';} if(rs==re){cs-=2;x++;ch[i++]=' ';ch[i++]='L';} if(rs==re&&cs==ce)break; }} else if(rs-re==0&&cs-ce<0){ while(cs!=ce){cs+=2;x++;ch[i++]=' ';ch[i++]='R';} } else if(rs-re==0&&cs-ce>0){ while(cs!=ce){cs-=2;x++;ch[i++]=' ';ch[i++]='L';}} else if(cs==ce&&(rs-re)>0){x+=abs(rs-re)/2;for(int g=0;g