#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int ins[110][110];
int lck[110];
bool lcell[110];
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) scanf("%d", &ins[i][j]);
  memset(lck, -1, sizeof lck);
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      if (ins[j][i] == 0) continue;
      if (lck[j] == -1) {
        if (lcell[ins[j][i]]) lck[j] = i;
        for (int k = 0; k < n; ++k) {
          if (j == k) continue;
          if (ins[j][i] == ins[k][i] && lck[k] == -1) {
            lck[j] = i;
            lcell[ins[j][i]] = true;
          }
        }
      }
    }
  }
  for (int i = 0; i < n; ++i) printf("%d\n", lck[i] + 1);
  return 0;
}
