n, k = map(int, input().split()) for i in range(0,n): cols = input().split(',') row = '' for j in range(0,n): one = cols[j] dup = '' for x in range(0,k): dup = dup + one row = row + dup for x in range(0,k): print(row)