#include <bits/stdc++.h>
using namespace std;
int n, k;
struct node {
  int low[12], high[12], sz;
  bool operator<(const node& a) const {
    for (int i = 0; i < k; i++) {
      if (high[i] > a.low[i]) return false;
    }
    return true;
  }
};
int main() {
  scanf("%d%d", &n, &k);
  set<node> S;
  for (int i = 0; i < n; i++) {
    node a;
    for (int j = 0; j < k; j++) {
      scanf("%d", &a.low[j]);
      a.high[j] = a.low[j];
    }
    a.sz = 1;
    set<node>::iterator l = S.lower_bound(a);
    set<node>::iterator r = S.upper_bound(a);
    while (l != r) {
      a.sz += l->sz;
      for (int j = 0; j < k; j++) {
        a.low[j] = min(a.low[j], l->low[j]);
        a.high[j] = max(a.high[j], l->high[j]);
      }
      S.erase(l++);
    }
    S.insert(a);
    printf("%d\n", S.rbegin()->sz);
  }
  return 0;
}
