#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int p[105] = {0}, x[105][105] = {}, d[105] = {0};
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> x[i][j];
  for (int j = 1; j <= m; j++)
    for (int i = 1; i <= n; i++) {
      if (x[i][j] == 0 || p[i]) continue;
      if (d[x[i][j]]) {
        p[i] = j;
        continue;
      }
      for (int l = i + 1; l <= n; l++)
        if (x[i][j] == x[l][j] && p[l] == 0) {
          p[i] = j;
          p[l] = j;
          d[x[l][j]] = 1;
        }
    }
  for (int i = 1; i <= n; i++) cout << p[i] << endl;
  return 0;
}
