#include <bits/stdc++.h>
using namespace std;
int n, m;
struct point {
  int ma[11], mi[11], sz;
  bool operator<(const point &ano) const {
    for (int i = 1; i <= m; i++) {
      if (ma[i] > ano.mi[i]) return 0;
    }
    return 1;
  }
} tmp;
set<point> S;
set<point>::iterator it, b;
int main() {
  int i, j, k, s;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      scanf("%d", &s);
      tmp.ma[j] = tmp.mi[j] = s;
    }
    tmp.sz = 1;
    b = S.upper_bound(tmp);
    for (it = S.lower_bound(tmp); it != b; S.erase(it++)) {
      tmp.sz += it->sz;
      for (j = 1; j <= m; j++) {
        tmp.mi[j] = min(tmp.mi[j], it->mi[j]);
        tmp.ma[j] = max(tmp.ma[j], it->ma[j]);
      }
    }
    S.insert(tmp);
    printf("%d\n", S.rbegin()->sz);
  }
  return 0;
}
