#include <iostream>
#include <cstdio>

using namespace std;

int counter = 0;

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

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

