#include <bits/stdc++.h>
int get() {
  static char pool[1 << 22], *tpr = pool + (1 << 22), *tp = tpr;
  char c;
  while (
      !isdigit(c = (tp < tpr ? 0 : fread(tp = pool, 1, 1 << 22, stdin), *tp++)))
    ;
  int k = c - '0';
  for (;
       isdigit(c = (tp < tpr ? 0 : fread(tp = pool, 1, 1 << 22, stdin), *tp++));
       k = k * 10 + c - '0')
    ;
  return k;
}
char opt[300000], *tp = opt;
void pnt(int x, char c) {
  static char stk[10], *top;
  for (top = stk; x; *top++ = x % 10 + 48, x /= 10)
    ;
  for (top == stk ? *tp++ = 48 : 0; top > stk; *tp++ = *--top)
    ;
  *tp++ = c;
}
using namespace std;
int n, k;
struct data {
  int l[10], r[10], s;
  bool operator<(const data &x) const {
    for (int i = 0; i <= k - 1; ++i)
      if (l[i] < x.r[i]) return 1;
    return 0;
  }
  bool operator>(const data &x) const {
    for (int i = 0; i <= k - 1; ++i)
      if (r[i] > x.l[i]) return 1;
    return 0;
  }
};
set<data> s;
int main() {
  n = get(), k = get();
  for (int i = 1; i <= n; ++i) {
    data t;
    for (int i = 0; i <= k - 1; ++i) t.l[i] = t.r[i] = get();
    t.s = 1;
    auto q = s.lower_bound(t);
    for (auto p = q; p != s.begin() && *--p > t; t.s += p->s, s.erase(p), p = q)
      for (int i = 0; i <= k - 1; ++i)
        t.l[i] = min(t.l[i], p->l[i]), t.r[i] = max(t.r[i], p->r[i]);
    s.insert(q, t);
    pnt(s.rbegin()->s, '\n');
  }
  fwrite(opt, 1, tp - opt, stdout);
  return 0;
}
