#include <bits/stdc++.h>
int CH, NEG;
template <typename TP>
inline void read(TP& ret) {
  ret = NEG = 0;
  while (CH = getchar(), CH < '!')
    ;
  if (CH == '-') NEG = true, CH = getchar();
  while (ret = ret * 10 + CH - '0', CH = getchar(), CH > '!')
    ;
  if (NEG) ret = -ret;
}
using namespace std;
int n, K;
struct node {
  int sz;
  int L[11LL], R[11LL];
  bool operator<(const node& B) const {
    int i;
    for (i = (1); i <= (K); i++)
      if (R[i] > B.L[i]) break;
    return i > K;
  }
  bool operator>(const node& B) const {
    int i;
    for (i = (1); i <= (K); i++)
      if (L[i] < B.R[i]) break;
    return i > K;
  }
} tmp;
int tot = 0;
set<node> S;
set<node>::iterator it1, it2;
void merge(node& A, const node& B) {
  A.sz += B.sz;
  int i;
  for (i = (1); i <= (K); i++)
    A.L[i] = std::min(A.L[i], B.L[i]), A.R[i] = std::max(A.R[i], B.R[i]);
}
int Add() {
  int i;
  tmp.sz = 1;
  for (i = (1); i <= (K); i++) read(tmp.L[i]), tmp.R[i] = tmp.L[i];
  if (S.empty()) {
    S.insert(tmp);
    return 1;
  }
  it1 = S.lower_bound(tmp);
  while (true) {
    if (it1 == S.end()) break;
    if (*it1 > tmp) break;
    it2 = it1;
    it1++;
    merge(tmp, *it2);
    S.erase(it2);
  }
  S.insert(tmp);
  it1 = S.end();
  it1--;
  return it1->sz;
}
int main() {
  S.clear();
  int i;
  read(n), read(K);
  for (i = (1); i <= (n); i++) {
    printf("%d\n", Add());
  }
END:
  getchar(), getchar();
  return 0;
}
