#include using namespace std; struct item{ pair curr, prev; int length; item(pair curr, pair prev, int length) : curr(curr), prev(prev), length(length){} }; int main() { int n; pair s, e; cin>>n; cin>>s.first>>s.second>>e.first>>e.second; queue q; q.push(item(s, s, 0)); vector< vector< int > > dist(n, vector(n, INT_MAX)); vector< vector< pair > > from_loc(n, vector >(n)); int best = INT_MAX; while(!q.empty()) { item it = q.front(); q.pop(); int r=it.curr.first, c=it.curr.second; if(r < 0 || r >= n) continue; if(c < 0 || c >= n) continue; if(dist[r][c] <= it.length) continue; from_loc[r][c] = it.prev; dist[r][c] = it.length; if(it.curr == e) { best = it.length; break; } q.push(item(make_pair(r-2, c-1), it.curr, it.length+1)); q.push(item(make_pair(r-2, c+1), it.curr, it.length+1)); q.push(item(make_pair(r, c+2), it.curr, it.length+1)); q.push(item(make_pair(r+2, c+1), it.curr, it.length+1)); q.push(item(make_pair(r+2, c-1), it.curr, it.length+1)); q.push(item(make_pair(r, c-2), it.curr, it.length+1)); } if(dist[e.first][e.second] == INT_MAX) { cout << "Impossible" << endl; }else{ pair t = e; cout << dist[e.first][e.second] << endl; vector v; while(t != s) { int dx = 0, dy = 0; int x = t.first, y = t.second, fx = from_loc[x][y].first, fy = from_loc[x][y].second; dx = x - fx; dy = y - fy; string dir = ""; if(dx < 0) dir += "U"; else if(dx > 0) dir += "L"; if(dy < 0) dir += "L"; else dir += "R"; v.push_back(dir); t = from_loc[x][y]; } reverse(v.begin(), v.end()); for(int i=0; i