#include #include #include #include using namespace std; typedef pair ii; typedef pair sii; typedef pair I; void printShortestPath(int n, ii start, ii end) { vector > vec(n,vector(n)); queue s; s.push(I(0,sii("",start))); while(s.size()>0) { I t=s.front(); s.pop(); int dist=t.first+1; int i=t.second.second.first,j=t.second.second.second; string str=t.second.first; if((min(i,j)<0)||(max(i,j)>=n)) continue; if(vec[i][j]) continue; vec[i][j]=true; if(ii(i,j)==end) { cout << dist-1 << endl; cout << str << endl; return; } s.push(I(dist,sii(str+"UL ",ii(i-2,j-1)))); s.push(I(dist,sii(str+"UR ",ii(i-2,j+1)))); s.push(I(dist,sii(str+"R ",ii(i,j+2)))); s.push(I(dist,sii(str+"LR ",ii(i+2,j+1)))); s.push(I(dist,sii(str+"LL ",ii(i+2,j-1)))); s.push(I(dist,sii(str+"L ",ii(i,j-2)))); } cout << "Impossible" << endl; } int main() { int n; cin >> n; ii start,end; cin >> start.first >> start.second >> end.first >> end.second; printShortestPath(n, start, end); return 0; }