#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
int k;
struct node {
  int sz, mn[15], mx[15];
};
set<node> s;
bool operator<(node a, node b) {
  for (int i = 1; i <= k; i++)
    if (a.mx[i] > b.mn[i]) return false;
  return true;
}
int main() {
  int n = read();
  k = read();
  for (int i = 1; i <= n; i++) {
    node wy;
    wy.sz = 1;
    for (int j = 1; j <= k; j++) {
      int d = read();
      wy.mn[j] = wy.mx[j] = d;
    }
    set<node>::iterator l = s.lower_bound(wy), r = s.upper_bound(wy);
    while (l != r) {
      wy.sz += (*l).sz;
      for (int j = 1; j <= k; j++) {
        wy.mn[j] = min(wy.mn[j], (*l).mn[j]);
        wy.mx[j] = max(wy.mx[j], (*l).mx[j]);
      }
      s.erase(l++);
    }
    s.insert(wy);
    write((*s.rbegin()).sz), puts("");
  }
  return 0;
}
