#include <iostream>
#include <cstdio>
using namespace std;
int counter;
int gcd(int a, int b){  
    if (b == 0)
    return a;    
    counter++;      
    return gcd(b, a%b);  
}
int main(void){ 
    int a, b, x;    
    while(cin>>a>>b){      
        if(a < b){         
            x = a;         
            a = b;        
            b = x;       
            }     
            if(a == 0 && b == 0)
            return 0;       
            counter = 0;    
            cout<<gcd(a,b)<<" ";
            cout<<counter<<endl;   
            }    
            return 0;
    
}

