#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6, maxd = 1000 + 7;
const long long mod = 1e9 + 7;
const int INF = 0x7f7f7f7f;
int n, k, x;
struct node {
  int mx[11], mi[11], sz;
  bool operator<(const node& a) const {
    for (int i = 1; i <= k; ++i)
      if (mx[i] > a.mi[i]) return 0;
    return 1;
  }
} tmp;
set<node> st;
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= k; ++j) {
      scanf("%d", &x);
      tmp.mi[j] = tmp.mx[j] = x;
      tmp.sz = 1;
    }
    auto x = st.lower_bound(tmp), y = st.upper_bound(tmp);
    while (x != y) {
      tmp.sz += (x->sz);
      for (int j = 1; j <= k; ++j) {
        tmp.mi[j] = min(tmp.mi[j], x->mi[j]);
        tmp.mx[j] = max(tmp.mx[j], x->mx[j]);
      }
      st.erase(x++);
    }
    st.insert(tmp);
    printf("%d\n", st.rbegin()->sz);
  }
  return 0;
}
