#include #define done std::ios::sync_with_stdio(false); cin.tie(NULL); #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; typedef long long ll; set v[250005]; int a[205][205]; int n; int level[40006]; bool vis[40006]; int par[40006]; void bfs(int s) { queue q; q.push(s); level[ s ] = 0 ; vis[ s ] = true; while(!q.empty()) { int p=q.front(); q.pop(); int x=p/n,y=p%n; if(y==0) y=n; else x++; if(x-2>=1 && y-1>=1){ int ch=n*(x-3)+y-1; if(!vis[ch]){ level[ch]=level[p]+1; q.push(ch); vis[ch]=1; par[ch]=p; } } if(x-2>=1 && y+1<=n){ int ch=n*(x-3)+y+1; if(!vis[ch]){ level[ch]=level[p]+1; q.push(ch); vis[ch]=1; par[ch]=p; } } if(y+2<=n){ int ch=n*(x-1)+y+2; if(!vis[ch]){ level[ch]=level[p]+1; q.push(ch); vis[ch]=1; par[ch]=p; } } if(x+2<=n && y+1<=n){ int ch=n*(x+1)+y+1; if(!vis[ch]){ level[ch]=level[p]+1; q.push(ch); vis[ch]=1; par[ch]=p; } } if(x+2<=n && y-1>=1){ int ch=n*(x+1)+y-1; if(!vis[ch]){ level[ch]=level[p]+1; q.push(ch); vis[ch]=1; par[ch]=p; } } if(y-2>=1){ int ch=n*(x-1)+y-2; if(!vis[ch]){ level[ch]=level[p]+1; q.push(ch); vis[ch]=1; par[ch]=p; } } } } int main() { cin>>n; int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; x1++,y1++,x2++,y2++; int s=(x1-1)*n+y1,d=(x2-1)*n+y2; for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) a[i][j]=(i-1)*n+j; // dfs(x1,y2); bfs(s); if(level[d]==0) cout<<"Impossible"; else{ cout< ss; for(int i=d;;i=par[i]) { if(i==s) break; if(i+2==par[i]) ss.pb("L"); if(i-2==par[i]) ss.pb("R"); if(i+2*n+1==par[i]) ss.pb("UL"); if(i+2*n-1==par[i]) ss.pb("UR"); if(i-2*n+1==par[i]) ss.pb("LL"); if(i-2*n-1==par[i]) ss.pb("LR"); } for(int i=ss.size()-1;i>=0;i--) cout<