#include <bits/stdc++.h>
using namespace std;
int n, x, k;
struct people {
  int mx[15], mi[15], sz;
  bool operator<(const people &rhs) const {
    for (int j = 1; j <= k; j++)
      if (mx[j] > rhs.mi[j]) return 0;
    return 1;
  }
} tmp;
set<people> s;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    tmp.sz = 1;
    for (int j = 1; j <= k; j++) {
      scanf("%d", &x);
      tmp.mi[j] = tmp.mx[j] = x;
    }
    auto x = s.lower_bound(tmp), y = s.upper_bound(tmp);
    while (x != y) {
      tmp.sz += x->sz;
      for (int j = 1; j <= k; j++)
        tmp.mi[j] = min(tmp.mi[j], x->mi[j]),
        tmp.mx[j] = max(tmp.mx[j], x->mx[j]);
      s.erase(x++);
    }
    s.insert(tmp);
    printf("%d\n", s.rbegin()->sz);
  }
  return 0;
}
