Problem 1912 --Repeater

## 1912: Repeater

Time Limit: 1 Sec  Memory Limit: 32 MB
Submit: 85  Solved: 21
[Submit][Status][Web Board][Creator:][下载FPS1元][添加到购物车][下载测试数据1元][796kb]

## Description

Harmony is indispensible in our daily life and no one can live without it----may be 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, but 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, and the template shows how the endless picture is created----use the characters as basic elements and put them in the right position to form a bigger template, and then repeat and repeat doing that. Here is an example.

# #
#      <-template
# #
So the Level 1 picture will be

# #
#
# #
Level 2 picture will be

# #     # #
#         #
# #     # #
# #
#
# #
# #    # #
#        #
# #    # #

## Input

The input contains multiple test cases.
The first line of each case is an integer N, representing the size of the template is N*N (N could only be 3, 4 or 5).
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*3000.

## Output

For each test case, just print the Level Q picture by using the given template.

## Sample Input

4
#  #
####
####
#  #
3
5
IIIII
I I
I   I
I I
IIIII
2
0

## Sample Output

#  #        #  #                                #  #        #  #
####        ####                                ####        ####
####        ####                                ####        ####
#  #        #  #                                #  #        #  #
#  ##  ##  ##  #                                #  ##  ##  ##  #
################                                ################
################                                ################
#  ##  ##  ##  #                                #  ##  ##  ##  #
#  ##  ##  ##  #                                #  ##  ##  ##  #
################                                ################
################                                ################
#  ##  ##  ##  #                                #  ##  ##  ##  #
#  #        #  #                                #  #        #  #
####        ####                                ####        ####
####        ####                                ####        ####
#  #        #  #                                #  #        #  #
#  #        #  ##  #        #  ##  #        #  ##  #        #  #
####        ########        ########        ########        ####
####        ########        ########        ########        ####
#  #        #  ##  #        #  ##  #        #  ##  #        #  #
#  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  #
################################################################
################################################################
#  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  #
#  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  #
################################################################
################################################################
#  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  #
#  #        #  ##  #        #  ##  #        #  ##  #        #  #
####        ########        ########        ########        ####
####        ########        ########        ########        ####
#  #        #  ##  #        #  ##  #        #  ##  #        #  #
#  #        #  ##  #        #  ##  #        #  ##  #        #  #
####        ########        ########        ########        ####
####        ########        ########        ########        ####
#  #        #  ##  #        #  ##  #        #  ##  #        #  #
#  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  #
################################################################
################################################################
#  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  #
#  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  #
################################################################
################################################################
#  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  #
#  #        #  ##  #        #  ##  #        #  ##  #        #  #
####        ########        ########        ########        ####
####        ########        ########        ########        ####
#  #        #  ##  #        #  ##  #        #  ##  #        #  #
#  #        #  #                                #  #        #  #
####        ####                                ####        ####
####        ####                                ####        ####
#  #        #  #                                #  #        #  #
#  ##  ##  ##  #                                #  ##  ##  ##  #
################                                ################
################                                ################
#  ##  ##  ##  #                                #  ##  ##  ##  #
#  ##  ##  ##  #                                #  ##  ##  ##  #
################                                ################
################                                ################
#  ##  ##  ##  #                                #  ##  ##  ##  #
#  #        #  #                                #  #        #  #
####        ####                                ####        ####
####        ####                                ####        ####
#  #        #  #                                #  #        #  #
IIIIIIIIIIIIIIIIIIIIIIIII
I I  I I  I I  I I  I I
I   II   II   II   II   I
I I  I I  I I  I I  I I
IIIIIIIIIIIIIIIIIIIIIIIII
IIIII     IIIII
I I       I I
I   I     I   I
I I       I I
IIIII     IIIII
IIIII               IIIII
I I                 I I
I   I               I   I
I I                 I I
IIIII               IIIII
IIIII     IIIII
I I       I I
I   I     I   I
I I       I I
IIIII     IIIII
IIIIIIIIIIIIIIIIIIIIIIIII
I I  I I  I I  I I  I I
I   II   II   II   II   I
I I  I I  I I  I I  I I
IIIIIIIIIIIIIIIIIIIIIIIII

[Submit][Status]