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