Repeater 题目描述 Harmony is indispensible in our daily life and no one can live without it, maybe Facer is the only exception. One day it is rumored that repeat painting will create harmony, and then hundreds of people started their endless drawing. Their paintings were based on a small template and a simple method of duplicating. Though Facer can easily imagine the style of the whole picture, he cannot find the essential harmony. Now you need to help Facer by showing the picture on computer. You will be given a template containing only one kind of character and spaces. The template shows how the endless picture is created: use the characters as basic elements, put them in the right positions to form a bigger template, and then repeat this process. Here is an example. The template is: # # The level 1 picture is: # # The level 2 picture is: # # # # # # # # # # # # # # # # # # # 输入格式 The input contains multiple test cases. The first line of each case is an integer $N$, representing that the size of the template is $N \times N$. $N$ can only be $3$, $4$ or $5$. The next $N$ lines describe the template. The following line contains an integer $Q$, which is the scale level of the picture. Input is ended with a case of $N = 0$. It is guaranteed that the size of one picture will not exceed $3000 \times 3000$. 输出格式 For each test case, print the level $Q$ picture using the given template. The picture is a complete square of size $N^Q \times N^Q$; spaces in the picture are meaningful and should be output as part of each line. Do not print extra blank lines between test cases. 输入样例 3 # # 1 4 OO O O O O OO 2 0 输出样例 # # OO OO O OO O O OO O OO OO OO OO O O O O O O O O OO OO OO OO O O O O O O O O OO OO OO OO O OO O O OO O OO OO