#include <bits/stdc++.h>
using namespace std;
int A[200][200], N, M, K, block[200];
bool Yadr[200], Yach[200];
map<int, int> mer;
int main() {
  cin >> N >> M >> K;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++) cin >> A[i][j];
  map<int, int>::iterator it;
  for (int j = 1; j <= M; j++) {
    for (int i = 1; i <= N; i++)
      if (A[i][j] != 0 && Yadr[i] == false)
        if (Yach[A[i][j]]) {
          Yadr[i] = true;
          block[i] = j;
        } else {
          it = mer.find(A[i][j]);
          if (it == mer.end())
            mer.insert(make_pair(A[i][j], i));
          else {
            Yadr[it->second] = true;
            block[it->second] = j;
            Yadr[i] = true;
            block[i] = j;
            Yach[A[it->second][j]] = true;
          }
        }
    mer.clear();
  }
  for (int i = 1; i <= N; i++) cout << block[i] << endl;
  return (0);
}
