#include <bits/stdc++.h>
using namespace std;
int n, k;
struct elem {
  int u[15];
  int d[15];
  int siz;
  void init(const int &a) {
    for (int i = 1; i <= k; ++i) {
      u[i] = d[i] = a;
    }
    siz = 0;
  }
  bool operator<(const elem &b) const {
    for (int i = 1; i <= k; ++i) {
      if (u[i] > b.d[i]) return 0;
    }
    return 1;
  }
  void merge(const elem &b) {
    siz += b.siz;
    for (int i = 1; i <= k; ++i) {
      u[i] = max(u[i], b.u[i]);
      d[i] = min(d[i], b.d[i]);
    }
  }
};
int qtot;
set<elem>::iterator Q[50005];
set<elem> S;
int main() {
  scanf("%d%d", &n, &k);
  elem tmp;
  for (int i = 1; i <= n; ++i) {
    tmp.siz = 1;
    for (int j = 1; j <= k; ++j) {
      scanf("%d", &tmp.d[j]);
      tmp.u[j] = tmp.d[j];
    }
    set<elem>::iterator pre = S.lower_bound(tmp);
    set<elem>::iterator nxt = S.upper_bound(tmp);
    set<elem>::iterator it;
    qtot = 0;
    for (it = pre; it != nxt; ++it) {
      Q[++qtot] = it;
    }
    for (int j = 1; j <= qtot; ++j) {
      tmp.merge(*Q[j]);
      S.erase(Q[j]);
    }
    S.insert(tmp);
    printf("%d\n", S.rbegin()->siz);
  }
  return 0;
}
