#include <bits/stdc++.h>
using namespace std;
int n, k;
struct node {
  int max[10], min[10], winNum;
  bool operator<(const node &a) const {
    for (int i = 0; i < k; i++) {
      if (max[i] > a.min[i]) {
        return false;
      }
    }
    return true;
  }
};
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  set<node> s;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    node a;
    for (int j = 0; j < k; j++) {
      cin >> a.max[j];
      a.min[j] = a.max[j];
      a.winNum = 1;
    }
    set<node>::iterator first = s.lower_bound(a);
    set<node>::iterator second = s.upper_bound(a);
    while (first != second) {
      a.winNum += first->winNum;
      for (int j = 0; j < k; j++) {
        a.min[j] = min(a.min[j], first->min[j]);
        a.max[j] = max(a.max[j], first->max[j]);
      }
      s.erase(first++);
    }
    s.insert(a);
    cout << s.rbegin()->winNum << endl;
  }
  return 0;
}
