## main

loop do
  h, w, n = gets.strip.split(' ').map{|s| s.to_i}
  break if (h | w | n) == 0

  drcs = h.times.map{gets.strip.split(' ').map{|s| s.to_i}}
  #p crs

  counts = (h + 1).times.map{(w + 1).times.map{0}}
  counts[0][0] = n - 1

  for y in (0...h)
    for x in (0...w)
      c = counts[y][x]
      d = drcs[y][x]
      c2 = c / 2

      counts[y + 1][x] += (c + 1 - d) / 2
      counts[y][x + 1] += (c + d) / 2
    end
  end

  for y in (0...h)
    for x in (0...w)
      drcs[y][x] ^= (counts[y][x] & 1)
    end
  end

  x = y = 0

  while x < w && y < h
    if drcs[y][x] == 0
      y += 1
    else
      x += 1
    end
  end

  puts [y + 1, x + 1].join(' ')
end