#include <bits/stdc++.h>
using namespace std;
const int N = 50005;
int n, k;
int powertable[N][10];
struct compo {
  int amount = 0;
  int powermin[10];
  int powermax[10];
  bool operator<(const compo a) const { return powermin[0] < a.powermin[0]; }
  bool lose(set<compo>::iterator a) {
    bool res = false;
    for (int i = 0; i < k; i++) {
      if (powermin[i] < a->powermax[i]) {
        res = true;
        break;
      }
    }
    return res;
  }
  bool win(set<compo>::iterator a) {
    bool res = false;
    for (int i = 0; i < k; i++) {
      if (powermax[i] > a->powermin[i]) {
        res = true;
        break;
      }
    }
    return res;
  }
};
set<compo> components;
void bind(set<compo>::iterator l, set<compo>::iterator r, compo& newone) {
  compo vi;
  vi.amount = 1;
  memcpy(vi.powermin, newone.powermin, 10 * sizeof(int));
  memcpy(vi.powermax, newone.powermax, 10 * sizeof(int));
  for (int i = 0; i < k; i++) {
    vi.powermax[i] = max(vi.powermax[i], r->powermax[i]);
    vi.powermin[i] = min(vi.powermin[i], l->powermin[i]);
  }
  for (auto it = r; it != l; it--) {
    vi.amount += it->amount;
  }
  vi.amount += l->amount;
  components.erase(l, ++r);
  components.insert(vi);
  return;
}
int main() {
  cin >> n >> k;
  int cur[10];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < k; j++) scanf("%d", cur + j);
    compo newone;
    newone.amount = 1;
    memcpy(newone.powermin, cur, sizeof(cur));
    memcpy(newone.powermax, cur, sizeof(cur));
    auto lbd = components.lower_bound(newone);
    if (components.size() == 0) {
      components.insert(newone);
    } else {
      auto fl = lbd;
      while (fl != components.begin() &&
             (fl == components.end() || newone.lose(fl)))
        fl--;
      if (!newone.lose(fl)) fl++;
      if (fl == components.end()) {
        components.insert(newone);
      } else {
        auto lw = fl;
        while (lw != components.end() && newone.win(lw)) lw++;
        if (lw == fl) {
          components.insert(newone);
        } else {
          lw--;
          bind(fl, lw, newone);
        }
      }
    }
    auto lastone = components.end();
    lastone--;
    cout << lastone->amount << endl;
  }
  return 0;
}
