The 8086 processor features an important instruction called "pop sp", which retrieves the stack pointer value from the top of the stack.
Additionally, the 80486 processor introduced another crucial instruction for manipulating the stack pointer register: "bswap sp". This instruction swaps the high and low bytes of the stack pointer.
The instruction code for "bswap sp" is 0F CC;
The instruction code for "pop sp" is 5C;
The memory segment is 65536 bytes long;
Memory is cyclic, such that after the address FFFF, the next address is 0000 (all addresses and codes are provided in hexadecimal form);
The "pop sp" instruction retrieves a two-byte word from the address pointed to by sp and loads it into sp, with the low byte first.
You are given the initial value of the sp register and the contents of memory. Construct the shortest program that, when executed, results in the specified final value in sp. The program should consist only of the instructions "pop sp" and "bswap sp".
The first line contains two sixteen-bit numbers between 0000 and FFFF, representing the initial and final values of the sp register. The next 4096 lines contain a memory segment dump.
The dump format is 8 bytes2 spaces8 bytes, where each 8 bytes is a sequence of 8 consecutive byte values separated by a single space. Each byte value is a two-digit hexadecimal number from 00 to FF.
On the first line, output the number of bytes in the shortest program in decimal. Starting from the second line, output a code dump of the resulting program in the same format as the input. The last (possibly incomplete) line of the dump must be immediately followed by a newline, with no trailing spaces after the last output byte.
If several shortest programs exist, output the lexicographically smallest one.
If it is impossible to accomplish the task with the given memory dump and sp values, output a single line containing the word IMPOSSIBLE.
Example 1