#include <bits/stdc++.h>
int main() {
  int map[110][110], lock[110], ans[110];
  memset(ans, 0, sizeof(ans));
  memset(lock, 0, sizeof(lock));
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &map[i][j]);
  int lockCell[110];
  memset(lockCell, 0, sizeof(lockCell));
  for (int x = 0; x < m; x++) {
    int ok = 1;
    int jud[110];
    memset(jud, 0, sizeof(jud));
    for (int y = 0; y < n; y++) {
      if (lock[y]) continue;
      if (map[y][x]) {
        if (jud[map[y][x]] || lockCell[map[y][x]]) {
          lockCell[map[y][x]] = 1;
          for (int i = 0; i < n; i++)
            if (map[i][x] == map[y][x]) {
              lock[i] = 1;
              if (!ans[i]) ans[i] = x + 1;
            }
        }
        jud[map[y][x]] = 1;
      }
    }
  }
  for (int i = 0; i < n; i++) printf("%d\n", ans[i]);
  return 0;
}
