#include using namespace std; int n; int ar[501][501]; vector ans; map m; bool cmp( string a , string b ){ if( m[a] < m[b] )return 1; return 0; } void fun(int i_start, int j_start, int i_end, int j_end){ int cnt = 0; if( j_end == 0 ){//left side if( i_start > i_end ){ while( i_start != i_end ){ i_start -= 2; if( cnt % 2 == 0 ){ ans.push_back("UR"); } else{ ans.push_back("UL"); } cnt++; } } else{ while( i_start != i_end ){ i_start += 2; if( cnt % 2 == 0 ){ ans.push_back("LR"); } else{ ans.push_back("LL"); } cnt++; } } } else if( j_end == n - 1 ){//right side if( i_start > i_end ){ while( i_start != i_end ){ i_start -= 2; if( cnt % 2 == 0 ){ ans.push_back("UL"); } else{ ans.push_back("UR"); } cnt++; } } else{ while( i_start != i_end ){ i_start += 2; if( cnt % 2 == 0 ){ ans.push_back("LL"); } else{ ans.push_back("LR"); } cnt++; } } } else{//right side if( i_start > i_end ){ while( i_start != i_end ){ i_start -= 2; if( cnt % 2 == 0 ){ ans.push_back("UL"); } else{ ans.push_back("UR"); } cnt++; } } else{ while( i_start != i_end ){ i_start += 2; if( cnt % 2 == 0 ){ ans.push_back("LR"); } else{ ans.push_back("LL"); } cnt++; } } } } void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { int cnt = 0; for( int i = i_start; i >= 0; i -= 2 ){ if( cnt % 2 == 0 ){ for( int j = j_start; j < n; j += 2){ ar[i][j] = 1; } for( int j = j_start - 2; j >= 0; j -= 2){ ar[i][j] = 1; } } else{ for( int j = j_start + 1; j < n; j += 2){ ar[i][j] = 1; } for( int j = j_start - 1; j >= 0; j -= 2){ ar[i][j] = 1; } } cnt++; } cnt = 1; for( int i = i_start + 2; i < n; i += 2 ){ if( cnt % 2 == 0 ){ for( int j = j_start; j < n; j += 2){ ar[i][j] = 1; } for( int j = j_start - 2; j >= 0; j -= 2){ ar[i][j] = 1; } } else{ for( int j = j_start + 1; j < n; j += 2){ ar[i][j] = 1; } for( int j = j_start - 1; j >= 0; j -= 2){ ar[i][j] = 1; } } cnt++; } /*for( int i = 0; i < n; i++ ){ cout << i << " -> "; for( int j = 0; j < n; j++ ){ cout << ar[i][j] << " "; } cout << "\n"; }*/ if( !ar[i_end][j_end] ){ cout << "Impossible"; return; } //cout <<"lele "; if( i_end < i_start && j_end < j_start ){//LL //cout << "1"; while( i_end != i_start ){ ans.push_back("UL"); //cout << "UL "; i_start -= 2; j_start -= 1; if( j_end == j_start ){ fun( i_start, j_start, i_end, j_end ); return; } } while( j_start != j_end ){ //cout << "L "; ans.push_back("L"); j_start -= 2; } } else if( i_end < i_start && j_end > j_start ){ //cout << "2"; while( i_end != i_start ){ //cout << "UR "; ans.push_back("UR"); i_start -= 2; j_start += 1; if( j_end == j_start ){ fun( i_start, j_start, i_end, j_end ); return; } } while( j_start != j_end ){ //cout << "R "; ans.push_back("R"); j_start += 2; } } else if( i_end > i_start && j_end < j_start ){ //cout << "3"; while( i_end != i_start ){ //cout << "LL "; ans.push_back("LL"); i_start += 2; j_start -= 1; if( j_end == j_start ){ fun( i_start, j_start, i_end, j_end ); return; } } while( j_start != j_end ){ //cout << "L "; ans.push_back("L"); j_start -= 2; } } else if( i_end > i_start && j_end > j_start ){ //cout << "4"; while( i_end != i_start ){ //cout << "LR "; ans.push_back("LR"); i_start += 2; j_start += 1; if( j_end == j_start ){ fun( i_start, j_start, i_end, j_end ); return; } } while( j_start != j_end ){ //cout << "R "; ans.push_back("R"); j_start += 2; } } //cout << "le"; } int main() { cin >> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> j_start >> i_end >> j_end; printShortestPath(n, i_start, j_start, i_end, j_end); if( ans.size() == 0 )return 0; cout << ans.size() << "\n"; m["UL"] = 1 , m["UR"] = 2 , m["R"] = 3 , m["LR"] = 4, m["LL"] = 5 , m["L"] = 6; sort( ans.begin() , ans.end() , cmp ); for( int i = 0; i < ans.size(); i++ ){ cout << ans[i] << " "; } return 0; }