import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) #input = sys.stdin.readline #n = int(input()) #alist = list(map(int,input().split())) #alist = [] #s = input() n,k = map(int,input().split()) grid = [list(input().rstrip()) for i in range(n)] #for i in range(n): # alist.append(list(map(int,input().split()))) for i in range(n*k): for j in range(n*k): print(grid[i//k][j//k],end='') print()