#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
void GCD(int a,int b,int n){
    if(!b){
        printf("%d %d\n",a,n);
        return;
    }
    GCD(b,a%b,n+1);
}
int main(){
    int a,b;
    while(cin>>a>>b){
        if(a==0&&b==0)break;
        GCD(max(a,b),min(a,b),0);
    }
    return 0;
}