#include #include #include #include #include #include using namespace std; int dp[215][215]; int parent[215][215]; int n; int N = 6; int dx[] = {-2, -2, 0, 2, 2, 0}; int dy[] = {-1, 1, 2, 1, -1, -2}; string s[] = {"UL","UR","R","LR","LL","L"}; bool isIn(int x, int y) { return (x >= 1 && y >= 1 && x <= n && y <= n); } int main() { cin >> n; int si, sj, ei, ej; cin >> si >> sj >> ei >> ej; si++, sj++, ei++, ej++; for(int i = 0; i < 210; ++i) for(int j = 0; j < 210; ++j) dp[i][j] = 1e9; dp[si][sj] = 0; queue > st; st.push(make_pair(si, sj)); while(st.size()) { pair cur = st.front(); st.pop(); for(int i = 0; i < N; ++i) { int x = cur.first + dx[i]; int y = cur.second + dy[i]; if (isIn(x,y) && dp[x][y] == 1e9) { dp[x][y] = dp[cur.first][cur.second] + 1; parent[x][y] = i; st.push(make_pair(x, y)); } } } if(dp[ei][ej] == 1e9) { cout << "Impossible" << endl; return 0; } cout << dp[ei][ej] << endl; vector ans; while(ei != si || ej != sj) { int k = parent[ei][ej]; ans.push_back(s[k]); ei -= dx[k], ej -= dy[k]; } reverse(ans.begin(), ans.end()); for(int i = 0; i < ans.size(); ++i) cout << ans[i] << " "; return 0; }