def main(): n, k = map(int, input().split()) a = [] for i in range(n): a.append(input()) print(a) b = [[]] print(b) for i in range(n*k): b.append([]) for j in range(n*k): b[-1].append(a[i//k][j//k]) for i in b: for j in i: print(j, end="") print("") if __name__ == "__main__": main()