#include <bits/stdc++.h>
using namespace std;
typedef int arr[100 + 10];
arr x[100 + 10], a, cor;
bool cel[100 + 10];
int i, j, k, p, n, m, K;
int main() {
  scanf(
      "%d"
      "%d"
      "%d"
      "\n",
      &n, &m, &K);
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= m; ++j) scanf("%d", &x[i][j]);
  for (j = 1; j <= m; ++j) {
    memset(a, 0, sizeof(a));
    for (i = 1; i <= n; ++i)
      if (!cor[i]) {
        if (cel[x[i][j]])
          cor[i] = j;
        else
          a[x[i][j]]++;
      }
    for (i = 1; i <= K; ++i)
      if (a[i] > 1) {
        cel[i] = 1;
        for (k = 1; k <= n; ++k)
          if (!cor[k] && x[k][j] == i) cor[k] = j;
      }
  }
  for (i = 1; i <= n; ++i)
    printf(
        "%d"
        "\n",
        cor[i]);
  return 0;
}
