#include<stdio.h>
long step;
long enclidean(long a, long b){
                step++;
                long c;
                c = a%b;
                if(c)return enclidean(b,c);
                else return b;
}
int main(){
        long a,b,c;

        while(scanf("%ld %ld",&a,&b), a+b != 0L){
                step = 0;
                if (a > b)
                        c = enclidean(a,b);
                else
                        c = enclidean(b,a);
                printf("%d %d\n",c,step);
        }
        return 0;
}