#include <bits/stdc++.h>
using namespace std;
int A[102][102];
int cell[102], done[102];
int ans[102];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> A[i][j];
  }
  for (int j = 0; j < m; j++) {
    memset(cell, 0, sizeof cell);
    for (int i = 0; i < n; i++) {
      if (ans[i] != 0 || A[i][j] == 0) continue;
      cell[A[i][j]]++;
    }
    for (int i = 0; i < n; i++) {
      if (ans[i] != 0 || A[i][j] == 0) continue;
      if (cell[A[i][j]] > 1 || done[A[i][j]]) {
        ans[i] = j + 1;
        done[A[i][j]] = 1;
      }
    }
  }
  for (int i = 0; i < n; i++) cout << ans[i] << endl;
  return 0;
}
