#include <bits/stdc++.h>
using namespace std;
int a[105][105], u[105], v[105];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &a[i][j]);
  for (int j = 0; j < m; j++) {
    int cnt[105] = {};
    for (int i = 0; i < n; i++)
      if (!u[i]) ++cnt[a[i][j]];
    for (int i = 0; i < n; i++)
      if (!u[i] && a[i][j]) {
        if (v[a[i][j]])
          u[i] = j + 1;
        else if (cnt[a[i][j]] >= 2)
          u[i] = v[a[i][j]] = j + 1;
      }
  }
  for (int i = 0; i < n; i++) printf("%d\n", u[i]);
}
