Tick-Tack-Toe is a famous simple game that is played on 3*3 grids. Two players put stones in the grids alternately and each one has his own color of stones that differ from the opponent's. The player that first gets a line of three stones vertically, horizontally, or diagonally wins the game. If the grids are all filled and no one makes a line of tree stones, the game is called a draw.
Sram Eel loves playing Tick-Tack-Toe very much. He plays it with his friend Tzxhsw every day. However, because of his weak skills, he always loses the game. Recently, he finally angers and decides to change the game to make it more interesting, that is, Cubic Tick-Tack-Toe!
Cubic Tick-Tack-Toe is played in 3*3*3 grids. Players put stones in the grids from bottom to top alternately, i.e. a stone cannot be putted in a grid, which is upon an empty grid. A player can win the game through getting one of the 49 lines of three stones. Tzxhsw is not so skilled in such a strange game, so she requests your help. To show your pure virtue, please put up your hands and knock on your keyboard!