#include <bits/stdc++.h>
using namespace std;
const int N = 103;
int n, m, k;
bool cantCheckRow[N];
bool isLocked[N];
int vec[N];
int arr[N][N];
int fre[N];
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) scanf("%d", &arr[i][j]);
  for (int col = 0; col < m; ++col) {
    memset(fre, 0, sizeof(fre));
    for (int row = 0; row < n; ++row) {
      if (cantCheckRow[row]) continue;
      if (arr[row][col] == 0) continue;
      ++fre[arr[row][col]];
    }
    for (int i = 0; i < N; ++i) isLocked[i] |= (fre[i] >= 2);
    for (int row = 0; row < n; ++row) {
      if (cantCheckRow[row]) continue;
      if (arr[row][col] == 0) continue;
      if (isLocked[arr[row][col]]) {
        vec[row] = col + 1;
        cantCheckRow[row] = true;
      }
    }
  }
  for (int i = 0; i < n; ++i) printf("%d\n", vec[i]);
  return 0;
}
