#include <bits/stdc++.h>
using namespace std;
const int MAX = 110;
int A[MAX][MAX], B[MAX], C[MAX];
int main() {
  int n, m, k, i, j;
  scanf("%d %d %d", &n, &m, &k);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) scanf("%d", &A[i][j]);
  for (j = 1; j <= m; j++) {
    for (i = 1; i <= n; i++) {
      if (!C[i]) B[A[i][j]]++;
    }
    for (i = 1; i <= n; i++)
      if (!C[i] && A[i][j]) {
        if (B[A[i][j]] >= 2)
          C[i] = j;
        else
          B[A[i][j]] = 0;
      }
  }
  for (i = 1; i <= n; i++) printf("%d\n", C[i]);
  return 0;
}
