#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    int a,b,i,x=0,y=0,count={0};
    cin>>a>>b;
    if(a<=b){
        x=b;y=a;
    }else if(a>=b){
        x=a;y=b;
    }
    for(i=0;i<1000;i++){
        x=x%y;
        swap(x,y);
        count++;
        if(y==0){
            break;
        }
    }
    cout<<x<<" "<<count<<endl;
    return 0;
}