#include <iostream>
#include <cstdio>

using namespace std;

int counter;

int gcd(int a, int b){
    int tmp;
    if(a>b){
       if (b == 0) return a;
       counter++;
       return gcd(b, a%b);}
    
    if(a<b){
       if (a == 0) return b;
       counter++;
       return gcd(a, b%a);}

   }

int main(void){
   int a, b;
   

    while(cin>>a>>b){
       if(a == 0 && b == 0)    return 0;
       counter = 0;
       cout<<gcd(a,b)<<" "<<counter<<endl;
    }
    return 0;
}
