#include <bits/stdc++.h>
using namespace std;
int n, m, k, vis[109];
int A[109][109];
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < 100; i++) fill(A[i], A[i] + 100, -100);
  for (int i = 0; i < n; i++)
    for (int h = 0; h < m; h++) cin >> A[i][h];
  for (int i = 0; i < m; i++) {
    for (int h = 0; h < n; h++) {
      if (h == 0 || A[h - 1][i] != A[h][i]) {
        for (int j = h + 1; j < n; j++) {
          if (A[h][i] == A[j][i] && A[j][i] != 0) {
            if (vis[h] == 0) vis[h] = i + 1;
            if (vis[j] == 0) vis[j] = i + 1;
            for (int k = 0; k < m; k++) A[j][k] = A[h][i];
            for (int k = 0; k < m; k++) A[h][k] = A[h][i];
          }
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << vis[i] << "\n";
  }
  return 0;
}
