#include <bits/stdc++.h>
int a[200][200], ind[200], banned[200];
int n, i, x, m, k, core[200], j, l;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (i = 1; i <= n; i++) {
    for (x = 1; x <= m; x++) scanf("%d", &a[i][x]);
  }
  for (i = 1; i <= m; i++) {
    for (x = 1; x <= n; x++) {
      if (a[x][i] != 0 && banned[x] == 0) ind[a[x][i]]++;
    }
    for (x = n; x >= 1; x--) {
      if (ind[a[x][i]] > 1 && banned[x] == 0) {
        if (core[x] == 0) core[x] = i, banned[x] = 1;
        for (j = x - 1; j >= 1; j--) {
          if (a[j][i] == a[x][i]) {
            if (core[j] == 0) core[j] = i, banned[j] = 1;
          }
        }
      } else if (ind[a[x][i]] >= 1 && banned[x] == 0) {
        ind[a[x][i]] = 0;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    printf("%d\n", core[i]);
  }
}
