#include <bits/stdc++.h>   using namespace std;   void Read(int &p) {     p = 0;     char c = getchar();     for (; c <  0  || c >  9 ; c = getchar())       ;     for (; c >=  0  && c <=  9 ; c = getchar()) p = p * 10 + c -  0 ;   }   int n, k;   struct Node {     long long siz;     int mxx[12], mnn[12];     bool operator<(const Node &b) const {       for (int i = 1; i <= k; i++)         if (mxx[i] > b.mnn[i]) return 0;       return 1;     }   } S;   set<Node> M;   int main() {     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++) {       S.siz = 1;       for (int j = 1; j <= k; j++) {         int x;         Read(x);         S.mnn[j] = S.mxx[j] = x;       }       set<Node>::iterator it = M.find(S);       while (it != M.end()) {         S.siz += it->siz;         for (int j = 1; j <= k; j++) {           S.mxx[j] = max(S.mxx[j], it->mxx[j]);           S.mnn[j] = min(S.mnn[j], it->mnn[j]);         }         M.erase(it);         it = M.find(S);       }       M.insert(S);       printf( %lld n , M.rbegin()->siz);     }   }   