#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
using namespace std;
int n,k;
struct node
{
int maxx[15],minn[15],sz;
node()
{
int x;sz = 1;
for(int i = 1; i <= k ; i ++)
{
scanf(“%d”,&x);
minn[i] = maxx[i] = x;
}
}
bool operator<(const node &nd)const
{
for(int i = 1; i <= k; i ++)
if(maxx[i] > nd.minn[i]) return false;
return true;
}
void merge(const node &nd)
{
for(int i = 1; i <= k; i ++){
minn[i] = min(minn[i],nd.minn[i]);
maxx[i] = max(maxx[i],nd.maxx[i]);
}
sz += nd.sz;
}
};
set<node> tr;
int main()
{
//freopen(“1.in”,”r”,stdin);
scanf(“%d%d”,&n,&k);
set<node>::iterator ub,lb;
for(int i = 1; i <= n;i ++)
{
node nd = node();
lb = tr.lower_bound(nd);
ub = tr.upper_bound(nd);
while(lb!=ub){
nd.merge(*lb);
tr.erase(lb++);
}
tr.insert(nd);
printf(“%d\n”,(tr.rbegin()) -> sz);
}
}