#include using namespace std; #define ll long long int #define mp make_pair #define mod 1000000000 int lolx[6]={-2,-2,0,2,2,0},loly[6]={-1,1,2,1,-1,-2}; string str[6]={"UL", "UR", "R" , "LR" , "LL", "L"}; int vis[505][505],dp[202][202][202]; stack st,lol; int dfs(int xs,int ys,int xe,int ye,int cnt,int n) { //cout << cnt << " " << xs << " " << ys << endl; if(cnt==0) { if(xs==xe && ys==ye){ // cout << "YES" << endl; return 1; } else return 0; } if(xs>=n || ys>=n || xs<0 || ys<0) return 0; if(dp[xs][ys][cnt]==-1) { dp[xs][ys][cnt]=1; for(int i=0;i<6;i++) { st.push(str[i]); if(dfs(xs+lolx[i],ys+loly[i],xe,ye,cnt-1,n)) return 1; st.pop(); } return 0; } else return 0; } int main() { int n; cin >> n; int xs,ys,xe,ye; cin >> xs >> ys >> xe >> ye; int r,w; r=xs,w=ys; queue > q,z; q.push(mp(xs,ys)); int flag=1,cnt=0; if(xs==xe && ys==ye) flag=0; vis[xs][ys]=1; while(!q.empty() && flag) { cnt++; while(!q.empty() && flag){ xs=q.front().first,ys=q.front().second; q.pop(); for(int i=0;i<6;i++) { int x=xs+lolx[i],y=ys+loly[i]; if(x=0 && y>=0 && vis[x][y]==0) { vis[x][y]=1; if(x==xe && y==ye) { flag=0; break; } z.push(mp(x,y)); } } } while(!z.empty()) { q.push(z.front()); z.pop(); } } if(flag==0) cout << cnt << endl; else { cout << "Impossible\n"; return 0; } memset(dp,-1,sizeof(dp)); dfs(r,w,xe,ye,cnt,n); //cout<< st.size() << endl; while(!st.empty()) { lol.push(st.top()); st.pop(); } while(!lol.empty()) { cout << lol.top() << " "; lol.pop(); } }