while true
    arr = gets.chomp.split.map(&:to_i)
    break if arr == [0, 0, 0]
    n, k, m = arr
    stones = (1..n).to_a
    stones.delete_at(m - 1)
    p = m - 1
    until stones.length == 1
        p = (p + k - 1) % stones.length
        stones.delete_at(p)
    end
    puts stones[0]
end
