#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int a,b;
    while(scanf("%d%d",&a,&b),a||b){
        if(a<b)swap(a,b);
        int cnt=0;
        while(b){
            cnt++;
            a%=b;
            swap(a,b);
        }
        printf("%d %d\n",a,cnt);
    }
    return 0;
}