import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] maxes = new int[m]; ArrayList> tops = new ArrayList<>(); for (int i = 0; i < m; i++) { tops.add(new HashSet<>()); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { HashSet ans = new HashSet<>(); for (int j = 0; j < m; j++) { int x = sc.nextInt(); if (maxes[j] < x) { maxes[j] = x; tops.get(j).clear(); tops.get(j).add(i); } else if (maxes[j] == x) { tops.get(j).add(i); } ans.addAll(tops.get(j)); } sb.append(ans.size()).append("\n"); } System.out.print(sb); } }