#include <bits/stdc++.h>
using namespace std;
int c[100][100], b[100] = {0}, mem[101] = {0};
int n, m, k;
void execCom(int t) {
  for (int i = 0; i < n; i++) {
    if (c[i][t] == 0) continue;
    if (b[i] != 0) continue;
    if (mem[c[i][t]] == 0)
      mem[c[i][t]] = i + 1;
    else if (mem[c[i][t]] == -1)
      if (b[i] == 0) {
        b[i] = t + 1;
      } else
        ;
    else {
      b[mem[c[i][t]] - 1] = t + 1;
      mem[c[i][t]] = -1;
      b[i] = t + 1;
    }
  }
}
void clearMem() {
  for (int i = 1; i <= k; i++)
    if (mem[i] != -1) mem[i] = 0;
}
void printBlocks() {
  for (int i = 0; i < n; i++) cout << b[i] << endl;
}
int main() {
  int i, j;
  cin >> n >> m >> k;
  for (i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> c[i][j];
  }
  for (j = 0; j < m; j++) {
    execCom(j);
    clearMem();
  }
  printBlocks();
  return 0;
}
