#include <bits/stdc++.h>
using namespace std;
bool bad[110];
bool marked[110];
int locked[110];
int x[110][110];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> x[j][i];
  for (int i = 1; i <= m; i++) {
    memset(marked, false, sizeof marked);
    for (int j = 1; j <= n; j++) {
      if (locked[j] > 0 || x[i][j] == 0) continue;
      if (marked[x[i][j]]) bad[x[i][j]] = true;
      marked[x[i][j]] = true;
    }
    for (int j = 1; j <= n; j++)
      if (locked[j] == 0 && bad[x[i][j]]) locked[j] = i;
  }
  for (int i = 1; i <= n; i++) cout << locked[i] << endl;
}
