#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long int LINF = 0x3f3f3f3f3f3f3f3fll;
const long double pi = acos(-1);
const int MOD = 1e9 + 9;
int n, m, k;
int core[110][110];
int trav[110];
int r[110];
vector<int> c[110];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &core[i][j]);
  for (int j = 1; j <= m; j++) {
    for (int i = 1; i <= n; i++) {
      if (r[i] > 0) continue;
      if (!trav[core[i][j]]) {
        c[core[i][j]].push_back(i);
      } else {
        r[i] = j;
      }
    }
    for (int i = 1; i <= k; i++) {
      if (c[i].size() > 1) {
        for (int x : c[i]) {
          r[x] = j;
        }
        trav[i] = 1;
      }
      c[i].clear();
    }
  }
  for (int i = 1; i <= n; i++) printf("%d\n", r[i]);
  return 0;
}
