/* Arunava Chakraborty [ @iArunava ] */ #include using namespace std; #define ll long long #define vi vector < int > #define vvi vector < vector < int > > #define vl vector < ll > #define vll vector < vector < ll > > #define pii pair < int, int > #define MODt97 1000000007 #define MODt99 1000000009 #define te5 100000 #define te6 1000000 #define te7 10000000 #define te8 100000000 #define te9 1000000000 #define fastio ios_base::sync_with_stdio (0); cin.tie (NULL); /* TODO */ int dir[][2] = {{-2, -1}, {-2, 1}, {0, 2}, {2, 1}, {2, -1}, {0, -2}}; int visited[300][300] = {}; vector < string > board[300][300] = {}; vector < string > moves; vector < string > minmoves; int n = 0, is = 0, js = 0, ie = 0, je = 0, i = 0, level = 0, fmmov = INT_MAX; string getmoves(int x) { switch (x) { case 0: return "UL"; break; case 1: return "UR"; break; case 2: return "R"; break; case 3: return "LR"; break; case 4: return "LL"; break; case 5: return "L"; break; default: return "L"; } } bool bfs (int x, int y) { int i = 0, tx = 0, ty = 0, flag = 0; pii pint; queue < pii > q; q.push (make_pair(x, y)); visited[x][y] = 0; while (!q.empty()) { pint = q.front(); q.pop(); x = pint.first; y = pint.second; for (i = 0; i < 6; ++i) { tx = x+dir[i][0]; ty = y+dir[i][1]; if (tx >=n || tx < 0 || ty >= n || ty < 0) continue; if (visited[tx][ty] != -1) continue; board[tx][ty] = board[x][y]; board[tx][ty].push_back(getmoves(i)); visited[tx][ty] = visited[x][y] + 1; if (tx == ie && ty == je) return true; q.push(make_pair (tx, ty)); } } return false; } int main () { //fastio; memset (visited, -1, sizeof visited); cin >> n; cin >> is >> js >> ie >> je; if (bfs(is, js)) { cout << visited[ie][je] << "\n"; for (i = 0; i < board[ie][je].size(); ++i) cout << board[ie][je][i] << " "; cout << "\n"; } else cout << "Impossible\n"; return 0; }