For each assignement the program prints out one line "Skladacka cislo C:" (Puzzle number C) where C is substitued by the number of the assignement. The numbering of assingement is ascending and begining with 1.
For each move in the list the program finds out if the move is valid. The move is valid if there is an empty field neighbouring. For each valid move the program prints out the following sentence at the separate line: "Kamen T presunut KAM." The tail number T moved KAM), where T is the number of the tile and KAM is one of the strings "doprava", "doleva", "nahoru" nebo "dolu" (right, left, up, down). If the move is not valid the sentence "Neplatny tah kamenem T." (Invalid move with tile T) is printed out.
When the list of moves ends, the program prints out the final state of the puzzle in the similar format that was used in the input. The output has to consist of R lines, each containing S numbers. The only difference from the input format is separating number by exactly one space. After each assignement (including the last one) the program prints out the empty line. Empty line consists only of the newline character.