while true
    h, w = gets.chomp.split.map(&:to_i)
    break if [h, w] == [0, 0]

    diag = h * h + w * w
    min, answer = nil, nil
    for y in (1..150).to_a.reverse
        for x in (y+1)..150
            d = x * x + y * y
            if d == diag && y > h
                min = d
                answer = [y, x]
            elsif d > diag && (min.nil? || min >= d)
                min = d
                answer = [y, x]
                break
            end
        end
    end
    puts answer.join(" ")
end
