#include <bits/stdc++.h>
using namespace std;
inline void PAUSE() {
  char tmp;
  cin >> tmp;
}
int M[100][100];
int N[100];
int K[100];
int n, m, k;
int magic(int j, int k) {
  for (int i = 0; i < n; i++) {
    if (i == j) continue;
    if (N[i] != 0) continue;
    if (M[j][k] == M[i][k]) return 1;
  }
  return 0;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &M[i][j]);
    }
  }
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) {
      if (N[i] != 0) continue;
      if (K[M[i][j]] == 1) {
        N[i] = j + 1;
        continue;
      }
      if (M[i][j] != 0 && magic(i, j)) {
        N[i] = j + 1;
        K[M[i][j]] = 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d", N[i]);
    printf("\n");
  }
  PAUSE();
  return 0;
}
