#include<bits/stdc++.h>
using namespace std;

int search(int n,int m,int &count){
  if(n%m==0){return m;}
  else{count++; return search(m,n%m,count);}
}




int main(){
  while(1){
  int n,m,count=0;
  cin>>n>>m;
  if(n==0 && m==0){break;}
  int ans=search(n,m,count);
  cout<<ans<<" "<<count+1<<endl;
  }
  
  return 0;
}

