#include <bits/stdc++.h>
using namespace std;
const int _ = 1e2;
const int maxn = 5e4 + _;
inline int mymax(int x, int y) { return x > y ? x : y; }
inline int mymin(int x, int y) { return x < y ? x : y; }
int K;
struct gr {
  int a[10];
  gr() { memset(a, 0, sizeof(a)); }
  friend gr operator+(gr x, gr y) {
    for (int i = 0; i < K; i++) x.a[i] = mymax(x.a[i], y.a[i]);
    return x;
  }
  friend gr operator-(gr x, gr y) {
    for (int i = 0; i < K; i++) x.a[i] = mymin(x.a[i], y.a[i]);
    return x;
  }
};
struct node {
  int f, son[2], c, s;
  gr m[2], d[2];
  node() { f = son[1] = son[0] = c = 0; }
} tr[110000];
int trlen, root;
void update(int x) {
  int lc = tr[x].son[0], rc = tr[x].son[1];
  tr[x].m[0] = tr[x].d[0];
  tr[x].m[1] = tr[x].d[1];
  tr[x].s = tr[x].c;
  if (lc)
    tr[x].m[0] = tr[x].m[0] - tr[lc].m[0],
    tr[x].m[1] = tr[x].m[1] + tr[lc].m[1], tr[x].s += tr[lc].s;
  if (rc)
    tr[x].m[0] = tr[x].m[0] - tr[rc].m[0],
    tr[x].m[1] = tr[x].m[1] + tr[rc].m[1], tr[x].s += tr[rc].s;
}
void rotate(int x, int w) {
  int f = tr[x].f, ff = tr[f].f;
  int R, r;
  R = f, r = tr[x].son[w];
  tr[R].son[1 - w] = r;
  if (r != 0) tr[r].f = R;
  R = ff, r = x;
  if (tr[R].son[0] == f)
    tr[R].son[0] = r;
  else if (tr[R].son[1] == f)
    tr[R].son[1] = r;
  tr[r].f = R;
  R = x;
  r = f;
  tr[R].son[w] = r;
  tr[r].f = R;
  update(f);
  update(x);
}
void splay(int x, int rt) {
  while (tr[x].f != rt) {
    int f = tr[x].f, ff = tr[f].f;
    if (ff == rt) {
      if (tr[f].son[0] == x)
        rotate(x, 1);
      else
        rotate(x, 0);
    } else {
      if (tr[ff].son[0] == f && tr[f].son[0] == x) {
        rotate(f, 1);
        rotate(x, 1);
      } else if (tr[ff].son[1] == f && tr[f].son[1] == x) {
        rotate(f, 0);
        rotate(x, 0);
      } else if (tr[ff].son[0] == f && tr[f].son[1] == x) {
        rotate(x, 0);
        rotate(x, 1);
      } else if (tr[ff].son[1] == f && tr[f].son[0] == x) {
        rotate(x, 1);
        rotate(x, 0);
      }
    }
  }
  if (rt == 0) root = x;
}
bool check(gr g, int x, int w) {
  for (int i = 0; i < K; i++)
    if ((tr[x].d[w ^ 1].a[i] > g.a[i]) ^ (w)) return false;
  return true;
}
int findp(gr g, int w) {
  int x = root, ret;
  while (x) {
    if (check(g, x, w))
      ret = x, x = tr[x].son[w ^ 1];
    else
      x = tr[x].son[w];
  }
  return ret;
}
int getans() {
  splay(1, 0), splay(2, 1);
  int x = tr[2].son[0], ss = 0;
  while (tr[x].son[1]) x = tr[x].son[1], ss++;
  splay(x, 0);
  return tr[x].c;
}
void pre() {
  gr g;
  for (int i = 0; i < K; i++) g.a[i] = (1 << 30);
  trlen = 2, root = 1;
  tr[1].son[1] = 2, tr[2].f = 1;
  tr[1].c = tr[2].c = tr[2].s = 1;
  tr[1].s = 2;
  tr[1].m[1] = tr[2].m[0] = tr[2].m[1] = tr[2].d[0] = tr[2].d[1] = g;
}
int main() {
  int n;
  gr g;
  scanf("%d%d", &n, &K);
  pre();
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < K; j++) scanf("%d", &g.a[j]);
    int x = findp(g, 0), y = findp(g, 1);
    splay(x, 0), splay(y, x);
    trlen++;
    int lc = tr[y].son[0];
    tr[trlen].m[0] = tr[trlen].d[0] = lc ? g - tr[lc].m[0] : g;
    tr[trlen].m[1] = tr[trlen].d[1] = lc ? g + tr[lc].m[1] : g;
    tr[trlen].c = tr[trlen].s = tr[lc].s + 1;
    tr[trlen].f = y;
    tr[y].son[0] = trlen;
    splay(trlen, 0);
    printf("%d\n", getans());
  }
  return 0;
}
