#include<iostream>
#include<map>
using namespace std;

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