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