#include <bits/stdc++.h>
using namespace std;
int n, m, k, x[105][105], c[105], used[105];
bool mem[105];
int main(void) {
  int i, j, t;
  while (scanf("%d %d %d", &n, &m, &k) != EOF) {
    memset(x, 0, sizeof(x));
    for (i = 1; i <= n; ++i)
      for (j = 1; j <= m; ++j) scanf("%d", &x[i][j]);
    memset(mem, 0, sizeof(mem));
    memset(c, 0, sizeof(c));
    for (j = 1; j <= m; ++j) {
      memset(used, 0, sizeof(used));
      for (i = 1; i <= n; ++i) {
        if (x[i][j] != 0 && c[i] == 0) {
          used[x[i][j]]++;
          if (used[x[i][j]] > 1) mem[x[i][j]] = true;
        }
      }
      for (i = 1; i <= n; ++i) {
        if (mem[x[i][j]] && c[i] == 0) c[i] = j;
      }
    }
    for (i = 1; i <= n; ++i) printf("%d\n", c[i]);
  }
  return 0;
}
