Tetris is a famous puzzle video game.A random sequence of tetrominoes —shapes composed of four square blocks each—fall down the playing field (a rectangular vertical well). The object of the game is to manipulate these tetrominoes, by moving each one sideways and rotating it by 90 degree units, with the aim of creating a horizontal line of blocks without gaps. When such a line is created, it disappears, and any block above the deleted line will fall. As the game progresses, the tetrominoes fall, and the game ends when the stack of tetrominoes reaches the top of the playing field and no new tetrominoes are able to enter. Here we consider only a simple variation of tetris. The playing field consists of 20 rows and 10 columns. There’re 7 kinds of tetrominoes:
Each kind of tetrominoes may have 4 kind of rotation,ie, rotating by 0,90,180,270 degrees.Here is a sample rotation of type 2 Tetromino:
We define the initial position of a tetromino in the falling sequences as the leftmost occupied column of the tetromino after rotation. For example,for a type 2 tetromino with 180 degree rotation and a initial position of 3 is just like:
After one move down, it will look likes:
You will be given a sequence of tetrominoes with their rotation degrees and their initial position.And in this game there is no player manipulating tetrominoes. Once their rotation degree and initial position are determined,the ending of the game is unique. You just simulate as the original Tetris and are required to output the playing field right before the end of game(if the game ends before the end of sequences,you should output the the playing field right before its ends.).Note if there are some horizontal line that are fully covered by blocks,we should first delete such lines then judging the end of game.