Another Game of Tetris

We introduce a new game of tetris. It is more fun, since you can choose the piece type yourself! The aim is to cleanup the whole board. i.e no single block should be found. For those who are not familiar with Tetris, let’s revise the basic rules of the game(note that some of the rules are modified to simplify the problem). The board has n columns, numbered 1, 2, . . . , n from left to right, and each column is infinitely high. 19 pieces are avaliable for you to choose. Note that all the pieces are listed here, so you don’t have to rotate them, just choose one column, then put it down to the lowest position. The rules are: • For each column, the occupied blocks should be successive starting from bottom at ANY TIME, so the board can be represented by an array of n integers indicating the ’height’(number of occupied blocks) of each column. • Every time, the player can choose two integers T (1 ≤ T ≤ 19) and C (1 ≤ C ≤ n), indicating the piece type and the column of the board (this column is aligned to the first column of the piece you chose). then, lay down the piece until it touches another block or the bottom of the board. Note that no part of the piece can be outside the board. • If every column has a height of at least x, then the bottom x rows of the board is cleaned (resulting that every column height is decreased by x). So it is true that: After any operation is finished, there is at least one column with no occupied block. Find a solution with no more than 10,000 operations to achieve the goal, i.e clean up the whole board.

2/2 Input The first line of the input is a single integer t (1 ≤ t ≤ 10), indicating the number of test cases. Each case contains 2 lines. The first line is a single integer n (1 ≤ n ≤ 100), indicating the number of columns. The next line contains n non-negative integers less than 10, indicating the number of occupied blocks in each column. Output For each test case, print a number of lines corresponding to the solution you found. Each line is consist of two integers T, C, indicating the block type and column you chose. Terminate your solution by a line with T = C = −1. Sample Input 2 5 00001 4 3230 Sample Output 21 -1 -1 14 91 -1 -1