//Copyright © 2017 Snehil Santhalia #include using namespace std; typedef long long ll; typedef long double ld; typedef vector vi; typedef vector vvi; typedef pair ii; typedef vector vii; typedef vector vvii; #define INF 1e18 #define loop(i,a,b) for(ll i=(ll)a;i<=(ll)b;i++) #define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ ) #define mem(a, v) memset(a, v, sizeof a) #define pb push_back #define mp make_pair #define MOD 1000000007 #define MAX(a,b) (((a)>(b))?(a):(b)) #define MIN(a,b) (((a)<(b))?(a):(b)) #define left(x) x<<1 #define right(x) (x<<1)|1 #define PI acos(-1.0) #define EPS 1e-9 int T = 1, N, a, b, x, y; int dis[205][205]; ii p[205][205]; string st[205][205]; int di[] = {-2, -2, 0, 2, 2, 0}; int dj[] = {-1, 1, 2, 1, -1,-2}; string find_func(int x) { if(x == 0) return "UL"; else if(x == 1) return "UR"; else if(x == 2) return "R"; else if(x == 3) return "LR"; else if(x == 4) return "LL"; else if(x == 5) return "L"; return ""; } void print_path(int x, int y) { if(x == a && y == b) return; print_path(p[x][y].first, p[x][y].second); cout << st[x][y] << " "; } void bfs(int u, int v) { dis[u][v] = 0; queue q; q.push(ii(u, v)); bool notFound = true; while(!q.empty() && notFound) { ii temp = q.front(); q.pop(); for(int i = 0; i < 6; i++) { int I = temp.first + di[i]; int J = temp.second+ dj[i]; //cout << I << " " << J << endl; if(I >=0 && J>=0 && I < N && J < N && dis[I][J] == -1) { dis[I][J] = dis[temp.first][temp.second] + 1; st[I][J] = find_func(i); p[I][J] = temp; if(I == x && J == y) { notFound = false; break; } q.push(ii(I,J)); } } } } void solve(){ cin >> N; cin >> a >> b >> x >> y; mem(dis, -1); bfs(a, b); if(dis[x][y] == -1) { cout << "Impossible" << endl; return; } cout << dis[x][y] << endl; print_path(x, y); cout << endl; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); //cin>>T; while(T--){ solve(); } return 0; }