#include <bits/stdc++.h>
using namespace std;
namespace Patchouli {
const int K = 10;
struct node {
  int min[K], max[K];
  int size;
  inline bool operator<(const node &b) const {
    for (int i = 0; i < K; ++i)
      if (max[i] > b.min[i]) return false;
    return true;
  }
  node() {
    memset(min, 0, sizeof(min));
    memset(max, 0, sizeof(max));
  }
};
inline node merge(const node a, const node b) {
  node res;
  res.size = a.size + b.size;
  for (int i = 0; i < K; ++i)
    res.min[i] = min(a.min[i], b.min[i]), res.max[i] = max(a.max[i], b.max[i]);
  return res;
}
inline int read() {
  int a = 1, b = 0;
  char t;
  do {
    t = getchar();
    if (t == '-') a = -1;
  } while (t > '9' || t < '0');
  do {
    b = b * 10 - '0' + t;
    t = getchar();
  } while (t >= '0' && t <= '9');
  return a * b;
}
int QAQ() {
  int n = read(), k = read();
  set<node> s;
  node tmp;
  for (int i = 1; i <= n; ++i) {
    tmp.size = 1;
    for (int j = 0; j < k; ++j) tmp.min[j] = tmp.max[j] = read();
    set<node>::iterator it;
    while ((it = s.find(tmp)) != s.end()) {
      tmp = merge(tmp, *it);
      s.erase(it);
    }
    s.insert(tmp);
    printf("%d\n", s.rbegin()->size);
  }
  return false;
}
}  // namespace Patchouli
int main() { return Patchouli::QAQ(); }
