#include <bits/stdc++.h>
using namespace std;
const long double pi = acosl(-1);
const int maxn = 100010;
const long long mod = 1e6 + 3;
const int inf = 1e9;
struct S {
  vector<int> lo, hi;
  int sz;
  S(vector<int> &a, vector<int> &b) : sz(1), lo(a), hi(b) {}
  bool operator<(const S &s) const {
    for (int i = 0; i < lo.size(); i++) {
      if (hi[i] > s.lo[i]) return 0;
    }
    return 1;
  }
  void merge(const S &s) {
    sz += s.sz;
    for (int i = 0; i < lo.size(); i++) {
      lo[i] = min(lo[i], s.lo[i]);
      hi[i] = max(hi[i], s.hi[i]);
    }
  }
};
set<S> ms;
int n, k;
vector<int> vec;
int main() {
  scanf("%d%d", &n, &k);
  vec.resize(k);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < k; j++) {
      scanf("%d", &vec[j]);
    }
    S s(vec, vec);
    auto l = ms.lower_bound(s);
    auto r = ms.upper_bound(s);
    while (l != r) {
      s.merge(*l);
      l = ms.erase(l);
    }
    ms.insert(s);
    printf("%d\n", ms.rbegin()->sz);
  }
  return 0;
}
