#include<iostream>
#include<algorithm>

using namespace std;

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

int main(void){
  int a,b;
  while(cin>>a>>b,a+b){
    step = 0;
    cout<<gcd(max(a,b),min(a,b));
    cout<<" "<<step<<endl;
  }
}