#include <bits/stdc++.h>
using namespace std;
int n, m, k, i, j;
int a[50000];
bool bl[200], blo[2000];
int in[200];
int x[102][102];
vector<int> kk, vf;
int main() {
  cin >> n >> m >> k;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) cin >> x[i][j];
  for (i = 1; i <= m; i++) {
    for (j = 1; j <= n; j++) a[j] = x[j][i];
    for (j = 1; j <= n; j++)
      for (k = j; k <= n; k++)
        if (!bl[j] && !bl[k] && a[j] == a[k] && !blo[a[j]] && a[j] != 0 &&
            k != j) {
          in[j] = i;
          in[k] = i;
          kk.push_back(j);
          kk.push_back(k);
          vf.push_back(a[j]);
        } else if (a[j] != 0 && blo[a[j]] && !bl[j]) {
          in[j] = i;
          kk.push_back(j);
        }
    for (j = 0; j < kk.size(); j++) bl[kk[j]] = 1;
    for (j = 0; j < vf.size(); j++) blo[vf[j]] = 1;
    kk.clear();
    vf.clear();
  }
  for (i = 1; i <= n; i++) cout << in[i] << endl;
}
