#include <cstdio>
using namespace std;
int main(void){
    long long  a,b,r,x,tmp;
    int cnt;
    char str[100];
    
    for( ;fgets(str,sizeof(str),stdin)!=NULL; ){
        sscanf(str,"%lld %lld",&a,&b);
        if(a==0 && b==0) break;
        x=a*b; cnt=1;
        if(a<b){
            tmp=a;
            a=b;
            b=tmp;
        }
        r=a%b;
        while(r!=0){
            a=b;
            b=r;
            r=a%b;
            cnt++;
        }
        printf("%lld %d\n",b,cnt);
    }
    return 0;
}