#include <bits/stdc++.h>
using namespace std;
int n, k;
struct node {
  int mx[10], mn[10], sz;
  node(int *a, int *b, int c) {
    sz = c;
    for (int i = 0; i < k; i++) mx[i] = a[i], mn[i] = b[i];
  }
  bool operator<(const node &e) const {
    for (int i = 0; i < k; i++)
      if (mx[i] >= e.mn[i]) return false;
    return true;
  }
  void add(node a) {
    sz += a.sz;
    for (int i = 0; i < k; i++)
      mx[i] = max(mx[i], a.mx[i]), mn[i] = min(mn[i], a.mn[i]);
  }
};
set<node> st;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    int is[10];
    for (int i = 0; i < k; i++) scanf("%d", is + i);
    node temp = {is, is, 1};
    auto l = st.lower_bound(temp), r = st.upper_bound(temp);
    while (l != r) {
      temp.add(*l);
      l = st.erase(l);
    }
    st.insert(temp);
    printf("%d\n", st.rbegin()->sz);
  }
}
