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