Working at the Restaurant#1252

Working at the Restaurant

1 second
128 megabytes
Very easy

Last night, Tom went on a date with a really nice girl. However, he forgot to take his credit card with him and he had no cash in his wallet, so he ended up working at the restaurant to pay for the bill. His task is to take plates from the waiter when he comes from the tables and pass them along to the dishwasher. It is very important for the plates to be washed in the same order as they are brought from the tables; otherwise, it could take too long before a plate is washed, and leftover food might get stuck. Holding all the plates in his hands is not a good idea, so Tom puts them on a table as soon as the waiter hands them over to him, and picks them up again when the time comes to pass them to the dishwasher. There is space for only two piles of plates on the table, which will be referred to as pile 1 and pile 2. Tom has only one table.

Tom won last year’s SWERC, so he can optimize any process efficiently. You have to output a transcript of one possible way in which Tom might decide to organize the plates on the table during the process, given the sequence of plates and requests he receives.

Input

The input consists of several test cases. The first line of each test contains an integer (1 \leq n \leq 1000). Next, lines follow, each containing either DROP m or TAKE m, where m > 0 is the number of plates to drop or take. DROP m means Tom takes plates from the waiter and puts them on the table. TAKE m means Tom takes plates from the table and puts them into the dishwasher in the same order. Tom will never get a TAKE m command if there are fewer than plates on the table. The total sum of all from DROP operations does not exceed 10^5. Note that there may still be plates left on the table after the last instruction, as Tom might be relieved of his duties and not stay until the restaurant closes.

The last test contains n = 0, which must not be processed.

Output

For each test case, output a set of lines describing the operations performed on the plates. Each line may be one of the following:

• DROP 1 m (DROP 2 m), m > 0, if Tom needs to put plates onto pile (pile ).

• TAKE 1 m (TAKE 2 m), m > 0, if Tom needs to take plates from pile (pile ) and hand them to the dishwasher.

• MOVE 1->2 m (MOVE 2->1 m), m > 0, if Tom needs to move plates from the top of pile (pile ) to the top of pile (pile ).

You must output at most lines, and the total number of plate movements in your transcript (that is, the sum of all printed for all three types of operations) must not exceed , otherwise Tom will not be able to handle all the work.

Tom must execute the commands in the same order as they appear. If he receives a TAKE m command, he must perform a certain number of MOVE and TAKE operations so that the total number of plates taken is exactly before processing the next command. If he receives a DROP m command, he must perform a number of DROP and MOVE operations so that the total number of dropped plates is exactly before proceeding to the next command.

It is forbidden to take plates from the waiter or pass them to the dishwasher without the corresponding command.

There must be an empty line between the outputs of different test cases.

Any solution satisfying these conditions will be accepted.

Examples

Example 1

Loading
Loading