#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int n, m, k;
int a[111][111];
int t[111];
bool locked[111];
int cores[111];
int main() {
  ios::sync_with_stdio(0);
  while (cin >> n >> m >> k) {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) cin >> a[i][j];
    memset(locked, 0, sizeof locked);
    memset(t, 0, sizeof t);
    for (int i = 1; i <= m; i++) {
      memset(cores, 0, sizeof cores);
      for (int j = 1; j <= n; j++) {
        if (t[j]) continue;
        cores[a[j][i]]++;
      }
      for (int j = 1; j <= k; j++) locked[j] |= cores[j] >= 2;
      for (int j = 1; j <= n; j++) {
        if (t[j]) continue;
        if (locked[a[j][i]]) t[j] = i;
      }
    }
    for (int i = 1; i <= n; i++) cout << t[i] << endl;
  }
  return 0;
}
