#include <bits/stdc++.h>
using namespace std;
long long int Pow(long long int B, long long int P) {
  long long int R = 1;
  while (P > 0) {
    if (P % 2 == 1) R = (R * B);
    P /= 2;
    B = (B * B);
  }
  return R;
}
int BigMod(long long int B, long long int P, long long int M) {
  long long int R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return (int)R;
}
int prime[90000];
bool flag[110];
int sieve() {
  int i, j, total = 0, val;
  val = sqrt(110) + 1;
  flag[0] = flag[1] = 1;
  for (i = 2; i < val; i++)
    if (!flag[i])
      for (j = i; j * i <= 110; j++) flag[i * j] = 1;
  for (i = 2; i <= 110; i++)
    if (!flag[i]) prime[total++] = i;
  return total;
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / (gcd(a, b)));
}
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
int mapped[110], chk[110], ans[110];
int arr[110][110], col[110];
int main() {
  int i, j, n, m, k, f;
  while (cin >> n >> m >> k) {
    memset(chk, 0, sizeof(chk));
    memset(ans, 0, sizeof(ans));
    for (i = 0; i < n; i++)
      for (j = 0; j < m; j++) cin >> arr[i][j];
    memset(mapped, 0, sizeof(mapped));
    memset(col, 0, sizeof(col));
    for (i = 0; i < m; i++) {
      memset(chk, 0, sizeof(chk));
      for (j = 0; j < n; j++) {
        if (col[j]) continue;
        if (mapped[arr[j][i]]) {
          ans[j] = i + 1;
          col[j] = 1;
        } else if (arr[j][i] > 0)
          chk[arr[j][i]]++;
      }
      for (j = 0; j < n; j++) {
        if (col[j]) continue;
        if (chk[arr[j][i]] > 1 || mapped[arr[j][i]]) {
          ans[j] = i + 1;
          mapped[arr[j][i]] = 1;
          col[j] = 1;
        }
      }
    }
    for (i = 0; i < n; i++) cout << ans[i] << endl;
  }
  return 0;
}
