#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int core[110] = {0};
  int mem[110] = {0};
  int ans[110] = {0};
  int a[110][110] = {0};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < m; i++) {
    for (int u = 0; u < n; u++) {
      if (mem[a[u][i]] && !core[u]) {
        core[u] = 1;
        ans[u] = i + 1;
      }
    }
    for (int u = 0; u < n; u++) {
      if (core[u]) continue;
      for (int v = 0; v < n; v++) {
        if (core[v]) continue;
        if (a[u][i] == a[v][i] && a[u][i] != 0 && u != v) {
          mem[a[u][i]] = 1;
          core[u] = 1;
          core[v] = 1;
          ans[u] = i + 1;
          ans[v] = i + 1;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << endl;
  }
}
