n,k,*s=open(0).read().split() k=int(k) for r in s: for _ in"_"*k:print("".join(i*k for i in r))