Dadas has Pepero sticks to deliver to Mog. Each stick has one of three types, . The original order is , and Mog wants to receive them in the order .
There are two initially empty stacks. The following commands are available.
0: Put the next unread input stick onto the first stack.1: Move the top stick of the first stack onto the second stack.2: Remove the top stick of the second stack and deliver it to Mog.Only the last stick placed on a stack may be removed. Command 0 is unavailable when no input sticks remain. Commands 1 and 2 are unavailable when their source stack is empty.
Determine whether every stick can be delivered in the desired order, and if so, construct a command sequence.
The input is given in the following format:
If it is impossible, print -1. Otherwise, print a string of length listing the commands in execution order. The string must contain only 0, 1, and 2, and every command must be executable when used. The delivery order must be exactly , and no input or stack contents may remain at the end. If multiple answers exist, print any of them.
| 3 | 55 | No additional constraints. |