#include using namespace std; int n; int sx, sy, dx, dy; vector> ans; vector>> instr; map name = { {0,"UL"}, {1, "UR"}, {2, "R"}, {3, "LR"}, {4, "LL"}, {5, "L"} }; bool valid( int x, int y ) { return x >= 0 && y >= 0 && x < n && y < n; } bool better ( int x, int y, vector moves ) { if ( ans[x][y] == -1 || instr[x][y].size() > moves.size() || instr[x][y][moves.size()-1] > instr[x][y][moves.size()-1]) return true; return false; } void solve( ) { ans[sx][sy] = 0; instr = vector>>(n, vector>(n)); vector> active = {{sx, sy}}; while(active.size() ) { vector> replace; const vector> delta = { {-2, -1}, {-2, 1}, {0, 2}, {2, 1}, {2, -1}, {0, -2} }; for ( auto p : active ) { for ( int i = 0; i < delta.size(); ++i ) { auto d = delta[i]; auto cand = p; cand.first += delta[i].first; cand.second += delta[i].second; auto mh = instr[p.first][p.second]; mh.push_back(i); if ( valid(cand.first, cand.second) && better(cand.first, cand.second, mh) ) { instr[cand.first][cand.second] = mh; ans[cand.first][cand.second] = mh.size(); replace.push_back(cand); } } } active = replace; } } void answer () { if ( ans[dx][dy] == -1 ) { cout << "Impossible" << endl; } else { cout << ans[dx][dy] << endl; cout << name[instr[dx][dy][0]]; for ( int i = 1; i < ans[dx][dy]; ++i ) { cout << ' ' << name[instr[dx][dy][i]]; } cout << endl; } } int main() { cin >> n >> sx >> sy >> dx >> dy; ans = vector>(n, vector(n, -1)); solve(); answer(); return 0; }