#include using namespace std; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { int i, j; int count=0; vector moves; if ( abs(i_start - i_end) % 2 != 0) cout << "Impossible" << endl; else { if ((abs(i_start - i_end)) % 2 == 0 ) { if (i_start > i_end) { if (j_start > j_end) { i = i_start; j = j_start; while (i != i_end) { i -= 2; j -= 1; count++; moves.push_back("UL"); } if (j_end < j) { while (j != j_end) { j -= 2; count++; moves.push_back("L"); } } else { while (j != j_end) { j += 2; count++; moves.push_back("R"); } } } } if (i_start > i_end) { if (j_start < j_end) { i = i_start; j = j_start; while (i != i_end) { i -= 2; j += 1; count++; moves.push_back("UR"); } if(j_end < j) { while (j != j_end) { j -= 2; count++; moves.push_back("L"); } } else { while (j != j_end) { j += 2; count++; moves.push_back("R"); } } } } if (i_start < i_end) { if (j_start < j_end) { i = i_start; j = j_start; while (i != i_end) { i += 2; j += 1; count++; moves.push_back("LR"); } if (j_end < j) { while (j != j_end) { j -= 2; count++; moves.push_back("L"); } } else if (j == j_end) { cout << count; return; } else { while (j != j_end) { j += 2; count++; moves.push_back("R"); } } } } if (i_start < i_end) { if (j_start > j_end) { i = i_start; j = j_start; while (i != i_end) { i += 2; j -= 1; count++; moves.push_back("LL"); } if (j_end < j) { while (j != j_end) { j -= 2; count++; moves.push_back("L"); } } else { while (j != j_end) { j += 2; count++; moves.push_back("R"); } } } } } } if (count == 0) { return; } else { cout << count << endl; for (int i=0; i> 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); return 0; }