#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
int main() {
  int i, j, q, n, m, k;
  int cp[105], mem[105];
  int t[105][105];
  cin >> n >> m >> k;
  for (i = 1; i <= n; ++i) cp[i] = 0;
  memset(mem, 0, sizeof(mem));
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= m; ++j) cin >> t[j][i];
  for (j = 1; j <= m; ++j) {
    for (i = 1; i <= n; ++i)
      if (t[j][i] > 0 && cp[i] == 0)
        if (mem[t[j][i]] == 0)
          mem[t[j][i]] = i;
        else {
          cp[mem[t[j][i]]] = j;
          mem[t[j][i]] = -1;
          cp[i] = j;
        }
    for (i = 0; i <= k; ++i)
      if (mem[i] > 0) mem[i] = 0;
  }
  for (i = 1; i <= n; ++i) cout << cp[i] << endl;
  return 0;
}
