#include <bits/stdc++.h>
int locked[101], ans[100];
int main(void) {
  int i, j;
  int n, m, k, x[100][100];
  scanf("%d %d %d", &n, &m, &k);
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) scanf("%d", x[i] + j);
  for (j = 0; j < m; j++) {
    int stack[101][100], sp[101] = {0};
    for (i = 0; i < n; i++)
      if (!ans[i]) stack[x[i][j]][sp[x[i][j]]++] = i;
    for (i = 1; i <= 100; i++)
      if (sp[i] >= 2 || locked[i]) {
        locked[i] = 1;
        while (sp[i]--) ans[stack[i][sp[i]]] = j + 1;
      }
  }
  for (i = 0; i < n; i++) printf("%d\n", ans[i]);
  return 0;
}
