#include using namespace std; typedef pair PII; const int dx[] = {-2, -2, 0, 2, 2, 0}; const int dy[] = {-1, 1, 2, 1, -1, -2}; const string op[] = {"UL", "UR", "R", "LR", "LL", "L"}; bool visited[205][205]; int pre[205][205]; queue q; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves. visited[i_start][j_start] = 1; q.push(make_pair(i_start, j_start)); int curx, cury, nxtx, nxty; while (q.size()) { curx = q.front().first; cury = q.front().second; if (curx == i_end && cury == j_end) break; q.pop(); for (int i = 0; i < 6; ++i) { nxtx = curx + dx[i]; nxty = cury + dy[i]; if (nxtx >= 0 && nxtx < n && nxty >= 0 && nxty < n && !visited[nxtx][nxty]) { visited[nxtx][nxty] = 1; pre[nxtx][nxty] = i; q.push(make_pair(nxtx, nxty)); } } } if (!q.size()) cout << "Impossible\n"; else { vector v; int tmpx; while (curx != i_start || cury != j_start) { tmpx = curx; v.push_back(op[pre[curx][cury]]); curx -= dx[pre[curx][cury]]; cury -= dy[pre[tmpx][cury]]; } cout << v.size() << "\n"; for (int i = v.size()-1; i >= 0; --i) cout << v[i] << " "; cout << "\n"; } } int main() { int n; 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); return 0; }