#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  int a[101][101];
  int b[101];
  int c[101];
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    c[i] = 0;
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
      a[i][j]--;
    }
  }
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < 101; i++)
      if (b[i] < 2 || j == 0) b[i] = 0;
    for (int i = 0; i < n; i++)
      if (a[i][j] > -1 && c[i] == 0) b[a[i][j]]++;
    for (int i = 0; i <= 100; i++)
      if (b[i] > 1) {
        for (int k = 0; k < n; k++)
          if (a[k][j] == i && c[k] == 0) c[k] = j + 1;
      }
  }
  for (int i = 0; i < n; i++) cout << c[i] << endl;
  return 0;
}
