#include <bits/stdc++.h>
const double E = 2.7182818284590452353602874713527;
using namespace std;
long ara[110][110], flag[110], flag1[110], res[110];
queue<long> qu, qu1;
int main() {
  long n, m, k, i, j, l, cnt, p, q;
  scanf("%ld%ld%ld", &n, &m, &k);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      scanf("%ld", &ara[i][j]);
    }
  }
  for (i = 1; i <= m; i++) {
    for (l = 1; l <= k; l++) {
      for (j = 1; j <= n; j++) {
        if (flag[j] == 0 && ara[j][i] == l && flag1[l] == 0) {
          qu.push(j);
        } else if (flag[j] == 0 && ara[j][i] == l && flag1[l] != 0) {
          qu1.push(j);
        }
      }
      if (qu.size() > 1) {
        while (!qu.empty()) {
          p = qu.front();
          flag[p] = 1;
          flag1[l] = 1;
          res[p] = i;
          qu.pop();
        }
      } else {
        while (!qu.empty()) qu.pop();
      }
      while (!qu1.empty()) {
        p = qu1.front();
        flag[p] = 1;
        flag1[l] = 1;
        res[p] = i;
        qu1.pop();
      }
    }
  }
  for (i = 1; i <= n; i++) {
    printf("%ld\n", res[i]);
  }
  return 0;
}
