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