Two instructions
The 8086 processor features a crucial instruction called "pop sp", which retrieves the stack pointer value from the top of the stack.
Additionally, the 80486 processor introduced another significant instruction for manipulating the stack pointer register: "bswap sp". This command 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, meaning that after the address FFFF, it wraps around to address 0000 (all addresses and codes are in hexadecimal).
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 provided with the initial value of the sp register and the contents of memory. Your task is to create the shortest program that results in the specified final value in sp. The program should only use the operations "pop sp" and "bswap sp".
Input
The first line contains two sixteen-bit numbers, ranging from 0000 to FFFF, representing the initial and final values of the sp register. The next 4096 lines contain the memory segment dump.
The dump format is [8 bytes][2 spaces][8 bytes], where each [8 bytes] consists of 8 consecutive byte values, separated by a single space. Each byte is a hexadecimal number from 00 to FF, always represented with two digits.
Output
On the first line, output the number of bytes in the shortest program in decimal. Starting from the second line, provide the dump of the resulting program code in the same format as the input. The last line of the dump, even if incomplete, should end with a newline immediately after the last byte, without trailing spaces.
If multiple shortest programs exist, output the lexicographically smallest one.
If it is impossible to achieve the task with the given memory dump and sp values, output a single line with the word IMPOSSIBLE.