import scala.io.StdIn.readLine

object Main extends App {
  def gcd(x:Int,y:Int,cnt:Int):String = if(y>0) { if(x>=y) gcd(y,x%y,cnt+1) else gcd(x,y%x,cnt+1) } else x + " " + cnt

  var s = "0 0"
  while( {s=readLine.trim;s} != "0 0" ){
    val n = s.split(" ").map(_.toInt);val x = n(0);val y = n(1)
    println(gcd(x,y,0))
  }
}