#include <bits/stdc++.h>
using namespace std;
int INF = 2e9;
int k = 10;
int targetGame = 0;
class cmp {
 public:
  bool operator()(const vector<int> &a, const vector<int> &b) const {
    return a[targetGame] < b[targetGame];
  }
};
vector<int> getMax(vector<int> x, vector<int> y) {
  vector<int> ans;
  for (int i = 0; i < k; i++) {
    ans.push_back(max(x[i], y[i]));
  }
  return ans;
}
vector<int> getMin(vector<int> x, vector<int> y) {
  vector<int> ans;
  for (int i = 0; i < k; i++) {
    ans.push_back(min(x[i], y[i]));
  }
  return ans;
}
bool canWin(vector<int> x, vector<int> y) {
  for (int i = 0; i < k; i++) {
    if (x[i] > y[i]) return true;
  }
  return false;
}
void insert(vector<int> &temp,
            map<vector<int>, pair<vector<int>, int>, cmp> &maxMin,
            map<vector<int>, pair<vector<int>, int>, cmp> &minMax) {
  vector<int> minVec, maxVec, INFvector;
  INFvector.assign(k, INF);
  minVec = INFvector;
  maxVec.assign(k, -1);
  for (int i = 0; i < k; i++) {
    vector<int> curr;
    curr.assign(k, -1);
    curr[i] = temp[i];
    targetGame = i;
    map<vector<int>, pair<vector<int>, int>, cmp>::iterator it1 =
        minMax.upper_bound(curr);
    if (it1 == minMax.end()) {
      maxVec = INFvector;
    } else {
      maxVec = getMax(maxVec, it1->first);
      minVec = getMin(minVec, it1->first);
    }
  }
  for (int i = 0; i < k; i++) {
    vector<int> curr;
    curr.assign(k, -1);
    curr[i] = temp[i];
    targetGame = i;
    map<vector<int>, pair<vector<int>, int>, cmp>::iterator it1 =
        maxMin.upper_bound(curr);
    if (it1 == maxMin.end()) {
      maxVec = INFvector;
    } else {
      maxVec = getMax(maxVec, it1->second.first);
      minVec = getMin(minVec, it1->second.first);
    }
  }
  vector<int> newMin = temp, newMax = temp;
  int newCount = 1;
  map<vector<int>, pair<vector<int>, int>, cmp>::iterator start1 =
      minMax.find(minVec);
  map<vector<int>, pair<vector<int>, int>, cmp>::iterator start2 = start1;
  map<vector<int>, pair<vector<int>, int>, cmp>::iterator end1 =
      minMax.find(maxVec);
  for (; start1 != end1; start1++) {
    newMin = getMin(newMin, start1->first);
    newMax = getMax(newMax, start1->second.first);
    newCount += start1->second.second;
    maxMin.erase(start1->second.first);
  }
  minMax.erase(start2, end1);
  minMax[newMin] = make_pair(newMax, newCount);
  maxMin[newMax] = make_pair(newMin, newCount);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n >> k;
  map<vector<int>, pair<vector<int>, int>, cmp> mapMinMax;
  map<vector<int>, pair<vector<int>, int>, cmp> mapMaxMin;
  for (int i = 0; i < n; i++) {
    vector<int> temp;
    for (int j = 0; j < k; j++) {
      int temp2;
      cin >> temp2;
      temp.push_back(temp2);
    }
    insert(temp, mapMaxMin, mapMinMax);
    int winCount = (mapMaxMin.rbegin())->second.second;
    cout << winCount << "\n";
  }
}
