#include #include #include #include #include #include #include #include #define MAX 205 #define IN(x, n) (0 <= (x) && (x) < n) using namespace std; char v[MAX][MAX]; pair vec[MAX][MAX]; void solve(pair p1, pair p2, int n){ int neig[6][2] = {{-2, -1}, {-2, 1}, {0, 2}, {2, 1}, {2, -1}, {0, -2}}; string coor[] = {"UL", "UR", "R", "LR", "LL", "L"}; queue > q; memset(v, -1, sizeof(v)); q.push(p1); v[p1.first][p1.second] = 0; bool ans = false; while(!q.empty()){ pair act = q.front(); q.pop(); for(int i = 0; i < 6; i++){ int x = act.first + neig[i][0], y = act.second + neig[i][1]; if(IN(x, n) && IN(y, n) && v[x][y] == -1){ v[x][y] = i+1; vec[x][y] = act; q.push(make_pair(x, y)); if(p2 == make_pair(x, y)){ ans = true; break; } } } } if(ans == false){ cout << "Impossible" << endl; return; } while(!q.empty()){ q.pop(); } pair act = p2; vector arr; while(act != p1){ //cout << act.first << " " << act.second << endl; arr.push_back(coor[v[act.first][act.second]-1]); act = vec[act.first][act.second]; } cout << arr.size() << endl; for(int i = arr.size()-1; i >= 0; i--){ cout << arr[i]<<" "; } return; } int main() { pair p1, p2; int n; while(cin >> n){ cin >> p1.first >> p1.second >> p2.first >> p2.second; solve(p1, p2, n); } return 0; }