#include <bits/stdc++.h>
using namespace std;
int n, k, p;
struct P {
  int low[11], high[11], sz;
  void merge(const P &x) {
    sz += x.sz;
    for (int i = (0); i <= (k - 1); i++)
      low[i] = min(low[i], x.low[i]), high[i] = max(high[i], x.high[i]);
  }
  bool operator<(const P &x) const {
    for (int i = (0); i <= (k - 1); i++)
      if (high[i] > x.low[i]) return 0;
    return 1;
  }
} x;
set<P> s;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = (0); i <= (n - 1); i++) {
    x.sz = 1;
    for (int j = (0); j <= (k - 1); j++)
      scanf("%d", &p), x.low[j] = x.high[j] = p;
    set<P>::iterator L = s.lower_bound(x), R = s.upper_bound(x);
    while (L != R) x.merge(*L), s.erase(L++);
    s.insert(x);
    printf("%d\n", int(s.rbegin()->sz));
  }
  return 0;
}
