#include <bits/stdc++.h>
using namespace std;
struct wan {
  int index;
  int value;
} a[1001][1001];
int main() {
  int f;
  int n, m, k;
  int b[1001];
  while (cin >> n >> m >> k) {
    int c = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        cin >> a[i][j].value;
        a[i][j].index = 0;
      }
    }
    for (int j = 1; j <= m; j++) {
      for (int i = 1; i <= n; i++) {
        if (a[i][j].value == 0)
          continue;
        else {
          f = 1;
          for (int k = 0; k < c; k++) {
            if (a[i][j].value == b[k]) {
              for (int w = 1; w <= m; w++) {
                a[i][w].value = 0;
                a[i][w].index = j;
              }
              f = 0;
              break;
            }
          }
          if (f == 0) continue;
          for (int k = i + 1; k <= n; k++) {
            if (a[i][j].value == a[k][j].value) {
              b[c++] = a[i][j].value;
              for (int w = 1; w <= m; w++) {
                a[i][w].value = 0;
                a[i][w].index = j;
              }
            }
          }
        }
      }
    }
    for (int i = 1; i <= n; i++) cout << a[i][1].index << endl;
  }
}
