#include using namespace std; using vs = vector; using vv = vector>>; using vi = vector; #define FORI(s,n) for(int i = s; i < n; i++) template void print (structure v) { for (auto e : v) cout << e << " "; cout << endl; } int n; int i_start, j_start, i_end, j_end; vs moves = {"UL", "UR", "R", "LR", "LL", "L"}; vi xoffset = {-1,1,2,1,-1,-2}; vi yoffset = {-2,-2,0,2,2,0}; vs empty = {}; pair p = make_pair (-1, empty); bool in_range (int x, int oldx) { if ((x < i_start || x < oldx) && x < i_end) return false; if ((x > i_start || x > oldx) && x > i_end) return false; return true; } void printShortestPath(int x, int y, int num_moves, vv& v, vs path, bool foundCol) { if (x < 0 || x >= n) return; if (y < 0 || y >= n) return; if (v[x][y].first != -1 && v[x][y].first <= num_moves) return; //cout << x << " " << y << endl; v[x][y].first = num_moves; v[x][y].second = path; vs orig_path = path; FORI (0, 6) { if ((x == j_end || foundCol) && (i == 2 || i == 5)) continue; int new_x = x + yoffset[i]; int new_y = y + xoffset[i]; if (in_range (new_x, x)) { path.push_back (moves[i]); printShortestPath (new_x, new_y, num_moves+1, v, path, (x == j_end || foundCol)); path = orig_path; } } } int main() { cin >> n; cin >> i_start >> j_start >> i_end >> j_end; if (abs (i_end - i_start) % 2 == 1) { cout << "Impossible" << endl; } else { int a = abs (i_end - i_start)/2; int b = abs (j_end - j_start); bool c = a % 2 == 0; bool d = b % 2 == 0; if (c != d) { cout << "Impossible" << endl; } else { vv v (n, vector> (n, p)); printShortestPath(i_start, j_start, 0, v, empty, false); auto res = v[i_end][j_end]; if (res.first == -1) { cout << "Impossible" << endl; } else { cout << res.first << endl; print (res.second); } } } return 0; }