def gcd a, b
    y, x = [a, b].minmax
    step = 0
    while y != 0
        x = x % y
        x, y = y, x
        step += 1
    end
    return [x, step]
end

while true
    a, b = gets.chomp.split.map(&:to_i)
    break if [a, b] == [0, 0]
    puts gcd(a, b).join(" ")
end
