#include <bits/stdc++.h>
using namespace std;
int instructions[105][105];
bool locked[105];
bool corelocked[105];
int done[105];
int res[105];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = (1); i <= (n); i++) {
    for (int j = (1); j <= (m); j++) {
      scanf("%d", &instructions[i][j]);
    }
  }
  for (int i = (1); i <= (m); i++) {
    memset(done, 0, sizeof done);
    for (int j = (1); j <= (n); j++) {
      if (corelocked[j]) continue;
      if (instructions[j][i] > 0) {
        if (locked[instructions[j][i]]) {
          res[j] = i;
          corelocked[j] = true;
        } else if (done[instructions[j][i]] > 0) {
          if (done[instructions[j][i]] != 200) {
            res[done[instructions[j][i]]] = i;
            locked[instructions[j][i]] = true;
            corelocked[done[instructions[j][i]]] = true;
            done[instructions[j][i]] = 200;
          }
          res[j] = i;
          corelocked[j] = true;
        }
        done[instructions[j][i]] = j;
      }
    }
  }
  for (int i = (1); i <= (n); i++) {
    printf("%d\n", res[i]);
  }
  return 0;
}
