#include <bits/stdc++.h>
using namespace std;
bool debug = false;
int n, k;
struct CC {
  int mx[15], mn[15], size;
  CC() {
    memset(mx, 0, sizeof(mx));
    memset(mn, 0, sizeof(mn));
    return;
  }
  void Union(CC ano) {
    for (int i = 0; i < k; i++) {
      mx[i] = max(mx[i], ano.mx[i]);
      mn[i] = min(mn[i], ano.mn[i]);
    }
    size += ano.size;
  }
};
bool operator<(const CC& a, const CC& b) {
  for (int i = 0; i < k; i++) {
    if (a.mx[i] > b.mn[i]) {
      return false;
    }
  }
  return true;
}
set<CC> cc;
int main(int argc, char* argv[]) {
  scanf("%d%d", &n, &k);
  CC fuck;
  for (int i = 0; i < k; i++) {
    fuck.mx[i] = fuck.mn[i] = 0;
  }
  fuck.size = 0;
  cc.insert(fuck);
  for (int i = 0; i < k; i++) {
    fuck.mx[i] = fuck.mn[i] = 2e9;
  }
  fuck.size = 0;
  cc.insert(fuck);
  for (int i = 0; i < n; i++) {
    CC node;
    for (int j = 0; j < k; j++) {
      int x;
      scanf("%d", &x);
      node.mx[j] = node.mn[j] = x;
    }
    node.size = 1;
    auto l = cc.lower_bound(node);
    auto r = cc.upper_bound(node);
    vector<set<CC>::iterator> tbdel;
    for (auto i = l; i != r; i++) {
      tbdel.push_back(i);
      node.Union(*i);
    }
    for (set<CC>::iterator it : tbdel) {
      cc.erase(it);
    }
    cc.insert(node);
    auto bitch = cc.end();
    bitch--;
    bitch--;
    cout << bitch->size << endl;
  }
  return 0;
}
