#include <bits/stdc++.h>
using namespace std;
int n, k;
const int maxk = 10;
struct Group {
  int sz, lo[maxk], hi[maxk];
  void read() {
    for (int i = 0; i < k; i++) {
      scanf("%d", lo + i);
      hi[i] = lo[i];
    }
  }
  void merge(const Group& t) {
    sz += t.sz;
    for (int i = 0; i < k; i++) {
      lo[i] = min(lo[i], t.lo[i]);
      hi[i] = max(hi[i], t.hi[i]);
    }
  }
  bool operator<(const Group& t) const {
    for (int i = 0; i < k; i++)
      if (hi[i] > t.lo[i]) return false;
    return true;
  }
};
set<Group> S;
int main() {
  scanf("%d%d", &n, &k);
  while (n--) {
    Group g;
    g.sz = 1;
    g.read();
    set<Group>::iterator l = S.lower_bound(g), r = S.upper_bound(g);
    while (l != r) {
      g.merge(*l);
      l = S.erase(l);
    }
    S.insert(g);
    printf("%d\n", (*S.rbegin()).sz);
  }
  return 0;
}
