{"raw_statement":[{"iden":"statement","content":"Gravitational Tetris is a Tetris variant that individual blocks can freely fall to the bottom. Therefore the game state of Gravitational Tetris can be described by an array of 10 integers, each representing the number of blocks (the height) of the column. The columns are numbered from 1 to 10. For example, the game state below can be described by the array [1, 5, 3, 0, 2, 0, 3, 1, 0, 1].\n\n\n\nYou are given a valid Gravitation Tetris game state. Your task is to continue to play the game such that all blocks are eliminated. A row will be eliminated when there are 10 blocks in the row. \n\nSince the blocks can freely fall, there are only 8 distinct Tetrominoes (shapes), with all rotations taken into account. The letter below each Tetromino denotes its type and its left-most column. In each move, you should select a Tetromino type and a column number c. For type A, it will fall onto column c. For type B, it will fall onto columns c, c + 1, c + 2 and c + 3. For type C, E and G, it will fall onto columns c and c + 1. For type D, F and H, it will fall onto columns c, c + 1 and c + 2. For example, from the above game state, after choosing type G and column 4, it will become:\n\n\n\nYou are allowed to use at most 1000 moves and there is no height restriction. Completed rows will be eliminated automatically.\n\nThe input consists of 10 integers, H1, H2, ..., H10 – the height of the columns from left to right. It is guaranteed that it is a valid game state and a solution exists.\n\n0 ≤ Hi ≤ 12. At least one of them is 0 but their sum is not 0.\n\nOutput any sequence of moves that can eliminate all blocks. You are not required to minimize the number of moves.\n\nIn the first line output a single integer M – the number of moves.\n\nIn each of the next M lines output the type of Tetromino (_A_ to _H_), a space, then the column number (1 to 10). Your answer will be regarded as incorrect if the column number is invalid for the type (e.g. column 8, 9 or 10 for type B).\n\nExplanation for Sample 1: \n\nExplanation for Sample 2: \n\n"},{"iden":"input","content":"The input consists of 10 integers, H1, H2, ..., H10 – the height of the columns from left to right. It is guaranteed that it is a valid game state and a solution exists.0 ≤ Hi ≤ 12. At least one of them is 0 but their sum is not 0."},{"iden":"output","content":"Output any sequence of moves that can eliminate all blocks. You are not required to minimize the number of moves.In the first line output a single integer M – the number of moves.In each of the next M lines output the type of Tetromino (_A_ to _H_), a space, then the column number (1 to 10). Your answer will be regarded as incorrect if the column number is invalid for the type (e.g. column 8, 9 or 10 for type B)."},{"iden":"examples","content":"Input1 1 0 1 1 1 0 1 0 2Output3B 4H 1H 7Input1 5 3 0 2 0 3 1 0 1Output11G 4A 1A 6D 8C 3C 9C 9E 7F 5B 1B 5"},{"iden":"note","content":"Explanation for Sample 1: Explanation for Sample 2: "}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ H = (H_1, H_2, \\dots, H_{10}) \\in \\mathbb{Z}_{\\geq 0}^{10} $ be the initial column heights, with $ \\sum_{i=1}^{10} H_i > 0 $ and $ \\exists i: H_i = 0 $, $ 0 \\leq H_i \\leq 12 $.  \n\nLet $ \\mathcal{T} = \\{A, B, C, D, E, F, G, H\\} $ be the set of Tetromino types.  \nFor each type $ T \\in \\mathcal{T} $, define its footprint $ f(T, c) \\subseteq \\{1, \\dots, 10\\} $ as the set of columns it occupies when placed at column $ c $:  \n- $ f(A, c) = \\{c\\} $  \n- $ f(B, c) = \\{c, c+1, c+2, c+3\\} $  \n- $ f(C, c) = f(E, c) = f(G, c) = \\{c, c+1\\} $  \n- $ f(D, c) = f(F, c) = f(H, c) = \\{c, c+1, c+2\\} $  \n\nEach placement of type $ T $ at column $ c $ increases the height of each column $ j \\in f(T, c) $ by 1.  \nAfter each move, any row with exactly 10 blocks across all 10 columns is cleared (all columns lose 1 block in that row; multiple rows may clear simultaneously).  \n\n**Constraints**  \n1. $ 1 \\leq M \\leq 1000 $ (number of moves)  \n2. For each move $ (T, c) $:  \n   - $ T \\in \\mathcal{T} $  \n   - $ c \\in \\{1, \\dots, 10\\} $  \n   - $ f(T, c) \\subseteq \\{1, \\dots, 10\\} $ (i.e., no out-of-bounds placement)  \n3. Initial state $ H $ is valid and a solution exists.  \n\n**Objective**  \nFind a sequence of $ M $ moves $ (T_1, c_1), (T_2, c_2), \\dots, (T_M, c_M) $ such that, after applying all moves and automatic row clears, the final state is $ (0, 0, \\dots, 0) $.","simple_statement":"You are given 10 column heights in a Gravitational Tetris game.  \nYou can place 8 types of Tetrominoes (A to H), each falling and filling columns as specified.  \nWhen a row is completely filled (10 blocks), it disappears.  \nYour goal: use at most 1000 moves to clear all blocks.  \nOutput any valid sequence of moves: for each, print the piece type (A-H) and starting column (1-10).  \nColumns must be valid for the piece type.","has_page_source":false}