def gcd_ex(x, y)
  if y == 0 then
    return [x, 0]
  else
    res = gcd_ex(y, x % y)
    res[1] += 1
    return res
  end
end

while (inputs = gets.split)[0] != "0"
  a = inputs[0].to_i
  b = inputs[1].to_i

  if a < b then
    tmp = a
    a = b
    b = tmp
  end

  puts gcd_ex(a, b).join(" ")
end