h,w=map(int,input().split()) cnt=0 for i in sorted(sum([[*map(int,input().split())] for _ in range(h)],[])): if cnt