var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
while(true){
   var str=Arr.shift();
   if(str=="0 0")break;
   var arr=str.split(" ").map(Number);
   arr.sort(function(a,b){return b-a;});
   var x=arr[0];
   var y=arr[1];
   var cnt=0;
   while(y!==0){
      var m=x%y;
      x=y;
      y=m;
      cnt++;
   }
   console.log(x+" "+cnt);
}