#include <iostream>
using namespace std;

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

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