#include #pragma GCC optimize("O3") using namespace std; typedef pair II; typedef vector< II > VII; typedef vector VI; typedef vector< VI > VVI; typedef long long int LL; #define PB push_back #define MP make_pair #define F first #define S second #define SZ(a) (int)(a.size()) #define ALL(a) a.begin(),a.end() #define SET(a,b) memset(a,b,sizeof(a)) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define si(n) scanf("%d",&n) #define dout(n) printf("%d\n",n) #define sll(n) scanf("%lld",&n) #define lldout(n) printf("%lld\n",n) #define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL) #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template void __f(const char* name, Arg1&& arg1){ cerr << name << " : " << arg1 << std::endl; }template void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); } #else #define trace(...) #endif //FILE *fin = freopen("in","r",stdin); //FILE *fout = freopen("out","w",stdout); int main(){ int n, dist[202][202], sx, sy, ex, ey, qs, qe; pair< II, string > path[202][202]; II Q[40004]; si(n); REP(i, n)REP(j, n)dist[i][j] = -1; si(sx);si(sy);si(ex);si(ey); auto update = [&](int x, int y, int d, II src, string how){ if(x < 0 || x >= n || y < 0 || y >= n || dist[x][y] != -1)return; dist[x][y] = d; Q[qe++] = MP(x, y); path[x][y] = MP(src, how); }; dist[sx][sy] = 0; qs = 0; qe = 0; Q[qe++] = MP(sx, sy); while(qs < qe){ int x, y, d; auto pos = Q[qs++]; x = pos.F;y = pos.S; d = dist[x][y]; d++; update(x - 2, y - 1, d, pos, "UL"); update(x - 2, y + 1, d, pos, "UR"); update(x, y + 2, d, pos, "R"); update(x + 2, y + 1, d, pos, "LR"); update(x + 2, y - 1, d, pos, "LL"); update(x, y - 2, d, pos, "L"); } if(dist[ex][ey] == -1){ puts("Impossible"); return 0; } dout(dist[ex][ey]); int x, y, req; vector ans; req = dist[ex][ey]; x = ex;y = ey; while(x != sx || y != sy){ auto z = path[x][y]; ans.PB(z.S); x = z.F.F;y = z.F.S; } for(int i = SZ(ans) - 1;i >= 0;i--){ printf("%s ", ans[i].c_str()); } puts(""); return 0; }