#include using namespace std; int n,sx , sy , dx , dy; int level[207][207]; string parentMove[207][207]; map reverseMove; string moves[] = {"UL" , "UR" , "R" , "LR" , "LL" , "L"}; pair applyMove(pair p , string s){ if(s=="L") p.second -= 2; else if(s=="R") p.second += 2; else if(s=="UL") p.first -= 2 , p.second -= 1; else if(s=="UR") p.first -= 2 , p.second += 1; else if(s=="LL") p.first += 2 , p.second -= 1; else p.first += 2 , p.second += 1; return p; } string detectMove(pair p , pair q){ for(int i=0;i<6;++i) if(applyMove(p , moves[i]) == q) return moves[i]; return "NULL"; } bool isValid(pair p){ return p.first>=0 && p.second >=0 && p.first < n && p.second < n; } void reverseMoves(){ for(int i=0;i<6;++i) reverseMove[moves[i]] = moves[(i+3)%6]; } void solve(){ for(int i=0;i > q; q.push(make_pair(sx , sy)); int flag = 0; while(!q.empty()){ pair x = q.front(); q.pop(); for(int i=0;i<6;++i){ pair y = applyMove(x , moves[i]); if(!isValid(y) || level[y.first][y.second] != -1) continue; level[y.first][y.second] = level[x.first][x.second]+1; parentMove[y.first][y.second] = moves[i]; q.push(y); if(y.first == dx && y.second == dy){ ++flag; break; } } if(flag) break; } if(level[dx][dy] == -1){ cout << "Impossible" << endl; return; } cout << level[dx][dy] << endl; stack s; int x = dx , y = dy; while(x != sx || y != sy){ s.push(parentMove[x][y]); pair p = applyMove(make_pair(x , y) , reverseMove[parentMove[x][y]]); x = p.first , y = p.second; } while(!s.empty()){ cout << s.top() << " "; s.pop(); } } int main() { reverseMoves(); cin >> n >> sx >> sy >> dx >> dy; solve(); return 0; }