#include using namespace std; typedef pair pii; #define fi first #define se second #define mp make_pair #define pb push_back const int N = 200; int ar[N + 5][N + 5]; vector moves[N + 5][N + 5]; pii arah[] = {mp(-2, -1), mp(-2, 1), mp(0, 2), mp(2, 1), mp(2, -1), mp(0, -2)}; string arah_str[] = {"UL", "UR", "R", "LR", "LL", "L"}; queue q; bool valid(int x, int y, int n){ return x >= 0 && y >= 0 && x < n && y < n; } void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves. memset(ar, -1, sizeof ar); ar[i_start][j_start] = 0; q.push(mp(i_start, j_start)); while(!q.empty()){ pii now = q.front(); q.pop(); for(int i = 0;i < 6; ++i){ pii next = mp(now.fi + arah[i].fi, now.se + arah[i].se); if(valid(next.fi, next.se, n) && ar[next.fi][next.se] == -1){ ar[next.fi][next.se] = ar[now.fi][now.se] + 1; moves[next.fi][next.se] = moves[now.fi][now.se]; moves[next.fi][next.se].push_back(arah_str[i]); q.push(next); } } } if(ar[i_end][j_end] == -1){ puts("Impossible"); return; } printf("%d\n", (int)moves[i_end][j_end].size()); for(int i = 0;i < (int)moves[i_end][j_end].size(); ++i){ printf("%s%c", moves[i_end][j_end][i].c_str(), (i == (int) moves[i_end][j_end].size() - 1) ? '\n' : ' '); } } int main() { int n; cin >> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> j_start >> i_end >> j_end; printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }