#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int n, k;
struct yasu {
  int x[15], y[15], sz;
  bool operator<(const yasu& O) const {
    for (int i = (1); i <= (k); ++i)
      if (x[i] > O.y[i]) return 0;
    return 1;
  }
} t;
set<yasu> s;
void input() {
  cin >> n >> k;
  for (int i = (1); i <= (n); ++i) {
    for (int j = (1); j <= (k); ++j) {
      int xx;
      cin >> xx;
      t.x[j] = t.y[j] = xx;
      t.sz = 1;
    }
    auto pos1 = s.lower_bound(t);
    auto pos2 = s.upper_bound(t);
    while (pos1 != pos2) {
      t.sz += pos1->sz;
      for (int j = (1); j <= (k); ++j) {
        t.y[j] = min(t.y[j], pos1->y[j]);
        t.x[j] = max(t.x[j], pos1->x[j]);
      }
      s.erase(pos1++);
    }
    s.insert(t);
    cout << s.rbegin()->sz << endl;
  }
}
void output() {}
int main() {
  input();
  output();
  return 0;
}
