class Solution:
def deleteGreatestValue(self, grid: List[List[int]]) -> int:
m=0
n=len(grid[0])
while n!=0:
l=[]
for i in grid:
i.sort()
l.append(i[-1])
i.pop(-1)
l.sort()
m=m+l[-1]
n=n-1
return m
for i in grid:
i.sort()
for g in zip(*grid): # g is a list/tuple of column elements
m+=max(g) # maximum element in g, i.e. maximum value in that column
return m