r,c = map(int,input().split())
m=[]
for i in range(r):
    m.append([int(j) for j in input().split()])
for i in range(r):
    for j in range(c):
        print(m[j][i],end=" ")
    print()        

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: