a, b = [int(x) for x in input().split()] for num in range(a): arr = input() temp = [] for char in arr: temp.append(char * b) thing = ''.join(temp) for num in range(b): print(thing)