#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # %% N, M = map(int, readline().split()) querys = readlines() # %% best_param_cnt = [0] * N best_param = [0] * M best_param_member = [[] for _ in range(M)] can_win_cnt = 0 # %% def solve(): global can_win_cnt for n, line in enumerate(querys): R = map(int, line.split()) for m, x in enumerate(R): if x < best_param[m]: continue if x == best_param[m]: best_param_member[m].append(n) best_param_cnt[n] += 1 continue best_param[m] = x best_param_cnt[n] += 1 for k in best_param_member[m]: best_param_cnt[k] -= 1 if best_param_cnt[k] == 0: can_win_cnt -= 1 best_param_member[m] = [n] can_win_cnt += (best_param_cnt[n] > 0) yield can_win_cnt # %% answers = solve() print('\n'.join(map(str, answers))) # %%