#include <bits/stdc++.h>
using namespace std;
int a[105][105];
int r[105], l[105], c[105];
int ans[105];
int main() {
  int i, j, n, m, k, flag;
  while (~scanf("%d%d%d", &n, &m, &k)) {
    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++) scanf("%d", &a[i][j]);
    memset(ans, 0, sizeof(ans));
    memset(r, 0, sizeof(r));
    memset(c, 0, sizeof(c));
    for (j = 1; j <= m; j++) {
      for (int i1 = 1; i1 <= n; i1++)
        if (!r[i1]) {
          if (c[a[i1][j]]) {
            r[i1] = 1;
            ans[i1] = j;
            continue;
          }
          if (!a[i1][j]) continue;
          for (int i2 = 1; i2 <= n; i2++)
            if (i1 != i2 && !r[i2]) {
              if (a[i1][j] == a[i2][j]) {
                c[a[i1][j]] = 1;
                r[i1] = r[i2] = 1;
                ans[i1] = ans[i2] = j;
              }
            }
        }
    }
    for (i = 1; i <= n; i++) printf("%d\n", ans[i]);
  }
  return 0;
}
