loop do
    h, w, n = gets.split.map(&:to_i)
    break if h == 0
    n -= 1
    a = (1..h).map { gets.split.map(&:to_i) }
    t = (1..h).map { Array.new(w, 0) }
    (0..h-1).each do |i|
        (0..w-1).each do |j|
            if i == 0 && j == 0
                t[i][j] = n
            end
            if a[i][j] == 0
                t[i+1][j] += (t[i][j] / 2.0).ceil  if i < h - 1
                t[i][j+1] += (t[i][j] / 2.0).floor if j < w - 1
            else
                t[i+1][j] += (t[i][j] / 2.0).floor if i < h - 1
                t[i][j+1] += (t[i][j] / 2.0).ceil  if j < w - 1
            end
        end
    end
    i = j = 0
    loop do
        if (a[i][j] + t[i][j]).even?
            i += 1
            break if i == h
        else
            j += 1
            break if j == w
        end
    end
    puts [i + 1, j + 1] * ' '
end

