#include <bits/stdc++.h>
using namespace std;
struct Group {
  int sz;
  vector<int> hi, lo;
  Group(int *a, int *b) : sz(1), hi(a, b), lo(a, b) {}
  bool operator<(const Group &b) const {
    for (int i = 0; i < hi.size(); i++) {
      if (hi[i] >= b.lo[i]) return false;
    }
    return true;
  }
  void merge(const Group &b) {
    sz += b.sz;
    for (int i = 0; i < hi.size(); i++) {
      hi[i] = max(hi[i], b.hi[i]);
      lo[i] = min(lo[i], b.lo[i]);
    }
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k, s[11];
  cin >> n >> k;
  set<Group> S;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < k; j++) cin >> s[j];
    Group g(s, s + k);
    auto lb = S.lower_bound(g), ub = S.upper_bound(g);
    for (auto it = lb; it != ub;) {
      g.merge(*it);
      it = S.erase(it);
    }
    S.insert(g);
    cout << S.rbegin()->sz << endl;
  }
}
