def func(s,m): t='' for i in range(len(s)): t+=s[i]*m return t n,k=map(int,input().split()) for i in range(n): a=input() for j in range(k): print(func(a,k))