H, W = map(int, input().split(' ')) grid = [input() for _ in range(H)] for i in range(W): for j in range(H): print(grid[H-1-j][i], end="") print()