#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e4 + 5;
struct node {
  vector<int> lo, hi;
  int sz;
  node() {}
  node(int *a, int *b) : sz(1), lo(a, b), hi(a, b) {}
  bool operator<(const node &o) const {
    for (int i = 0; i < lo.size(); i++) {
      if (hi[i] >= o.lo[i]) return false;
    }
    return true;
  }
  void merge(const node &o) {
    sz += o.sz;
    for (int i = 0; i < lo.size(); i++) {
      lo[i] = min(lo[i], o.lo[i]);
      hi[i] = max(hi[i], o.hi[i]);
    }
  }
};
int n, k, s[15];
int main() {
  set<node> G;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < k; j++) {
      scanf("%d", &s[j]);
    }
    node player(s, s + k);
    auto i0 = G.lower_bound(player), i1 = G.upper_bound(player);
    while (i0 != i1) {
      player.merge(*i0);
      i0 = G.erase(i0);
    }
    G.insert(player);
    printf("%d\n", G.rbegin()->sz);
  }
  return 0;
}
