ATMs

No attempts yetTime limit1sMemory limit128 MB

Problem

The Credit Society of Byteland lets any member borrow any whole number of Bytelandish ducats below 103010^{30}, and the entire sum must be paid back within seven days.

The Society's Client Service Room holds 100 ATMs, numbered 00 through 9999. Each ATM only ever performs one fixed action tied to its number: ATM ii pays out 2i2^i ducats if ii is even, and collects 2i2^i ducats if ii is odd.

A client borrows a given amount by using each ATM at most once so that the net cash flow equals that amount: ducats paid out by even ATMs are gained, and ducats collected by odd ATMs are given up. For each client we must decide whether the requested amount can be borrowed this way and, if it can, which ATMs to use. We ask the same question about returning the amount, where the net cash flow must instead equal the negative of that amount.

For example, to borrow 77 ducats a client takes 1616 ducats from ATM 44 and 11 ducat from ATM 00, then pays 88 ducats into ATM 33 and 22 ducats into ATM 11; the net is 16+182=716 + 1 - 8 - 2 = 7. To return 77 ducats the client takes 11 ducat from ATM 00 and pays 88 ducats into ATM 33; the net is 18=71 - 8 = -7.

Write a program that reads the number of clients and each requested amount, decides for every client whether the amount can be borrowed and whether it can be returned, and reports the ATMs to use in each case.

Input

The first line contains a single positive integer nn (n1000n \le 1000), the number of clients. Each of the next nn lines contains one positive integer smaller than 103010^{30} (up to 30 decimal digits): the amount the corresponding client wants to borrow.

Output

Print 2n2n lines, two for each client, in input order. For client ii:

  • the first line lists the numbers of the ATMs, in strictly decreasing order and separated by single spaces, that the client uses to borrow the requested amount, or the single word NIE if borrowing it under the rules is impossible;
  • the second line lists, in the same format, the ATMs used to return the amount, or NIE if returning it is impossible.

Every ATM number lies in the range [0,99][0, 99]. (NIE means "no".)