#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long INFLL = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 5e5 + 5;
int n, k;
struct nodes {
  int maxn[12], minn[12], siz;
  bool operator<(const nodes& x) const {
    int f = 1;
    for (int i = 1; i <= k; i++)
      if (maxn[i] > x.minn[i]) f = 0;
    return f;
  }
};
int main() {
  cin >> n >> k;
  multiset<nodes> s;
  for (int i = 1; i <= n; i++) {
    nodes now;
    for (int j = 1; j <= k; j++) {
      scanf("%d", &now.maxn[j]);
      now.minn[j] = now.maxn[j];
    }
    now.siz = 1;
    auto p = s.lower_bound(now);
    auto p2 = s.upper_bound(now);
    nodes nxt = now;
    vector<multiset<nodes>::iterator> v;
    for (auto sp = p; sp != p2; sp++) {
      for (int i = 1; i <= k; i++) {
        nxt.maxn[i] = max(nxt.maxn[i], sp->maxn[i]);
        nxt.minn[i] = min(nxt.minn[i], sp->minn[i]);
      }
      nxt.siz += sp->siz;
      v.push_back(sp);
    }
    for (int i = 0; i < v.size(); i++) s.erase(v[i]);
    s.insert(nxt);
    printf("%d\n", s.rbegin()->siz);
  }
}
