#include <bits/stdc++.h>
using namespace std;
int n, k, x;
struct P {
  int mi[11], mx[11], S;
  bool operator<(P a) const {
    for (int i = 1; i <= k; i++)
      if (mx[i] > a.mi[i]) return 0;
    return 1;
  }
} o;
set<P> S;
set<P>::iterator il, ir, it;
int main() {
  scanf("%d", &n);
  scanf("%d", &k);
  for (; n--; printf("%d\n", (*it).S)) {
    P o;
    o.S = 1;
    for (int j = 1; j <= k; j++) scanf("%d", &x), o.mi[j] = o.mx[j] = x;
    il = S.lower_bound(o);
    ir = S.upper_bound(o);
    for (; il != ir; S.erase(il++)) {
      o.S += (*il).S;
      for (int j = 1; j <= k; j++)
        o.mi[j] = min(o.mi[j], (*il).mi[j]),
        o.mx[j] = max(o.mx[j], (*il).mx[j]);
    }
    S.insert(o);
    it = S.end();
    it--;
  }
}
