#include #define fi first #define se second using namespace std; const int maxn = 2e2 + 7; const int inf = 1e9 + 7; vector > mov = { { 2,1}, { 2 , -1}, {0,-2},{-2,-1},{-2,1},{0,2},}; vector odp = {"UL", "UR", "R", "LR", "LL","L"}; int odl[maxn][maxn]; int stan[maxn][maxn]; int n; queue > q; pair skad(pair a,int s) { return {a.fi - mov[s].fi, a.se - mov[s].se}; } inline void zrob(int x) { // cout<= n ) return 1; return 0; } int main() { cin>>n; for(int i = 0 ; i <= n + 3 ; i++) for(int j = 0 ; j <= n + 3 ; j++ ) { stan[i][j] = -1; odl[i][j] = inf; } pair pocz,kon; cin>>pocz.first>>pocz.second; cin>>kon.first>>kon.second; odl[kon.fi][kon.se] = 0; q.push(kon); while(!q.empty()) { pair a = q.front(); q.pop(); for(int i = 0 ; i < mov.size() ; i++) { auto s = mov[i]; int xx = a.fi + s.fi; int yy = a.se + s.se; if(nie(xx) || nie(yy)) continue; if(odl[xx][yy] > odl[a.fi][a.se] + 1) { odl[xx][yy] = odl[a.fi][a.se] + 1; stan[xx][yy] = i; q.push({xx,yy}); } if(odl[xx][yy] == odl[a.fi][a.se] + 1 && stan[xx][yy] > i) stan[xx][yy] = i; } } if(stan[pocz.fi][pocz.se] == -1) { cout<<"Impossible\n"; return 0; } vector V; swap(pocz,kon); while(kon != pocz) { V.push_back(stan[kon.fi][kon.se]); kon = skad(kon,stan[kon.fi][kon.se]); } cout<