#include <bits/stdc++.h>
using namespace std;
int muisti[101][101];
int kasky[101][101];
int lukittu[101];
int mlukittu[101];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++)
    for (int e = 0; e < m; e++) cin >> kasky[i][e];
  for (int e = 0; e < m; e++)
    for (int i = 0; i < n; i++) {
      if (lukittu[i]) continue;
      if (!kasky[i][e]) continue;
      if (muisti[e][kasky[i][e]] != 0 || mlukittu[kasky[i][e]]) {
        lukittu[muisti[e][kasky[i][e]] - 1] = e + 1;
        lukittu[i] = e + 1;
        mlukittu[kasky[i][e]] = 1;
      } else
        muisti[e][kasky[i][e]] = i + 1;
    }
  for (int i = 0; i < n; i++) cout << lukittu[i] << endl;
  return 0;
}
