from sys import stdin board = [[0]*10]*10 for s in stdin: row,col= map(int,s.split()) for i in range(row): board[i] = list(map(int,input().split())) for i in range(col): for j in range(row): print(board[j][i],end = ' ') print()