#include <bits/stdc++.h>
using namespace std;
int n, m, k, r;
int com[120][120];
int b[120];
unsigned int bp[120];
bool bm[120];
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      scanf("%d", &com[i][j]);
    }
  for (unsigned int j = 0; j < m; ++j) {
    for (int i = 0; i < n; ++i) {
      if (bp[i + 1] == 0) b[com[i][j]]++;
    }
    for (int i = 1; i <= k; ++i) {
      if (b[i] > 1) bm[i] = true;
      b[i] = 0;
    }
    for (int i = 0; i < n; ++i)
      if (bm[com[i][j]] && !bp[i + 1]) bp[i + 1] = j + 1;
  }
  for (int i = 1; i <= n; ++i) printf("%u\n", bp[i]);
  return 0;
}
