with open('input.txt', 'r') as f:
nums = f.read().splitlines()
rows=nums[1:]
common=[]
result_string=''
for r in rows:
arr=r.split(' ')
common.append(arr)
for i in range(len(common[0])):
for j in range(len(common)):
result_string+=str(common[j][i])+' '
print(result_string)