#include <bits/stdc++.h>
using namespace std;
int n, k;
struct node {
  int mx[11], mn[11], num;
  friend bool operator<(const node &A, const node &B) {
    int ok = 1;
    for (int i = 1; i <= k; i++) ok &= A.mx[i] < B.mn[i];
    return ok;
  }
  friend node operator+(const node &A, const node &B) {
    node C;
    C.num = A.num + B.num;
    for (int i = 1; i <= k; i++)
      C.mx[i] = max(A.mx[i], B.mx[i]), C.mn[i] = min(A.mn[i], B.mn[i]);
    return C;
  }
};
inline int read(register int a = 0, register char ch = getchar()) {
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9')
    a = (a << 3) + (a << 1) + (ch ^ 48), ch = getchar();
  return a;
}
set<node> QAQ;
int main() {
  n = read(), k = read();
  for (int i = 1; i <= n; i++) {
    node tmp;
    tmp.num = 1;
    for (int j = 1; j <= k; j++) tmp.mx[j] = tmp.mn[j] = read();
    set<node>::iterator it = QAQ.find(tmp);
    while (it != QAQ.end()) {
      tmp = tmp + (*it);
      QAQ.erase(it);
      it = QAQ.find(tmp);
    }
    QAQ.insert(tmp);
    printf("%d\n", (*QAQ.rbegin()).num);
  }
}
