#include #include #include #include using namespace std; const int dx[] = {-2,-2,0,2,2,0}; const int dy[] = {-1,1,2,1,-1,-2}; int n; int x1,y1,x2,y2; int dist[205][205]; int vis[205][205]; int path[205][205]; pair < int , int > parent[205][205]; bool valid(int a,int b){ return (a>= 0 && a<= n-1 && b>= 0 && b<=n-1); } int main() { cin >> n; cin >> x1 >> y1 >> x2 >> y2; queue < pair < int , int > > Q; for(int i = 0 ;i<= 200 ; i++){ for(int j = 0; j<= 200 ; j++){ dist[i][j] = 1000000000; } } Q.push({x1,y1}); vis[x1][y1] = 1; dist[x1][y1] = 0; while(!Q.empty()){ pair < int , int > top = Q.front(); Q.pop(); for(int i = 0 ; i < 6 ; i++){ int nx = top.first + dx[i]; int ny = top.second + dy[i]; if(valid(nx,ny) && !vis[nx][ny]){ dist[nx][ny] = 1 + dist[top.first][top.second]; vis[nx][ny] = 1; path[nx][ny] = i; parent[nx][ny] = top; Q.push({nx,ny}); } } } map < int , string > m; m[0] = "UL"; m[1] = "UR" ; m[2] = "R" ; m[3] = "LR" ; m[4] = "LL" ; m[5] = "L"; if(dist[x2][y2] >= 10000000){ cout <<"Impossible\n"; } else { cout << dist[x2][y2] << endl; vector < string > ans; ans.clear(); pair < int , int > node = {x2,y2}; while(node != make_pair(x1,y1)){ ans.push_back(m[path[node.first][node.second]]); node = parent[node.first][node.second]; } while(!ans.empty()){ cout << ans.back() <<" "; ans.pop_back(); } cout << endl; } return 0; }