N,M = map(int,input().split()) src = [list(map(int,input().split())) for i in range(N)] maxs = [0] * M ss = [set() for i in range(M)] ans = [] for i,skills in enumerate(src): for j,skill in enumerate(skills): if skill > maxs[j]: maxs[j] = skill ss[j] = set([i]) elif skill == maxs[j]: ss[j].add(i) tmp = set() for s in ss: tmp |= s ans.append(len(tmp)) print(*ans,sep='\n')