#include <bits/stdc++.h>
using namespace std;
int main(){
while(1){
int a,b,count=0;
cin>>a>>b;
if(a==0 && b==0) break;
int x,y;

if(a >= b) x = a,y = b;
else x = b, y = a;
while(1){
x = x % y; 
swap(x,y); count++;
if(y == 0 ) break;
}cout<<x<<" "<<count<<endl;
}
return 0;
}


