#include <bits/stdc++.h>
long a, b, c, i, j, k, core[200][200], lock[200], cell[200], res[200], n, m;
int main() {
  scanf("%ld%ld%ld", &n, &m, &k);
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) scanf("%ld", &core[i][j]);
  for (a = 0; a < m; a++) {
    for (i = 0; i < n; i++) {
      if (cell[core[i][a]] == 1 && core[i][a] != 0 && lock[i] == 0) {
        lock[i] = 1;
        res[i] = a + 1;
      }
      if (lock[i] == 0)
        for (j = 0; j < n; j++) {
          if (i != j && core[i][a] == core[j][a] && lock[j] == 0 &&
              cell[core[i][a]] == 0 && core[i][a] != 0 && core[j][a] != 0 &&
              lock[i] == 0) {
            res[i] = a + 1;
            res[j] = a + 1;
            ;
            lock[i] = 1;
            lock[j] = 1;
            cell[core[i][a]] = 1;
          }
          if (cell[core[j][a]] == 1 && core[j][a] != 0 && lock[j] == 0) {
            lock[j] = 1;
            res[j] = a + 1;
          }
        }
    }
  }
  for (i = 0; i < n; i++) printf("%ld\n", res[i]);
}
