There are multiple data sets. Each set consists of a line containing the word, followed by four lines representing the board. Every word is at most sixteen letters long. The number of data sets is deliberately unspecified; you only know that the judge's solution can process them all in one quarter of the time limit. The end of input is marked by a blank line.