N,M=map(int, input().split()) for i in range(N): l=input() for j in range(M): for k in l: print(k*M,end="") print("\n")