#include <iostream>
#include <cstdio>

using namespace std;

int counter;

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

int main(void){
   int a, b, tmp;
   if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

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