from bisect import bisect_left,bisect_right from itertools import accumulate from sys import stdin def main(): N,M = map(int, stdin.readline().split()) L = [list(map(int, stdin.readline().split())) for _ in range(N)] D = [] for l in L: D.append(sorted(list(set(l)))) ng = -1 ok = 10**9+100 while (abs(ok - ng) > 1): mid = (ok + ng) // 2 S = list(range(len(D[0]))) for i in range(N-1): ND = D[i+1] IMOS = [0]*(len(ND)+1) for s in S: d = D[i][s] l = bisect_left(ND,d) r = bisect_right(ND,d+mid) IMOS[l]+=1 IMOS[r]-=1 NS = [] L = list(accumulate(IMOS)) for j,l in enumerate(L): if l>0 and j