#include using namespace std; typedef long long ll; #define se second #define fi first #define pb push_back const int N=205; string d[]={ "UL", "UR", "R", "LR", "LL", "L" }; int dx[]={ -2, -2, 0, 2, 2, 0 }; int dy[]={ -1, 1, 2, 1, -1, -2 }; int sx,sy,tx,ty; int vis[N][N]; pair > par[N][N]; int n; void back(int x,int y){ if(x == sx && y == sy) return; back(par[x][y].fi,par[x][y].se.fi); printf("%s ",d[par[x][y].se.se].c_str()); } void bfs(){ vis[sx][sy]=0; par[sx][sy]={-1,{-1, -1}}; queue > q; q.push({ sx, sy }); while(!q.empty()){ int x=q.front().fi,y=q.front().se; q.pop(); if(x == tx && y == ty){ printf("%d\n",vis[tx][ty]); back(tx,ty); exit(0); } for(int i=0;i < 6;i++){ int xx=dx[i] + x,yy=dy[i] + y; if(xx >= 0 && xx < n && yy >= 0 && yy < n && vis[xx][yy] == -1){ vis[xx][yy]=vis[x][y] + 1; q.push({ xx, yy }); par[xx][yy] ={x,{y,i}}; } } } puts("Impossible"); } int main(){ // freopen("in.txt","r",stdin); scanf("%d%d%d%d%d",&n,&sx,&sy,&tx,&ty); memset(vis,-1,sizeof vis); bfs(); return 0; }