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

int main(){
  
  int X,Y,counter;

  while(1){

  cin >>X>>Y;

  if(X == 0 && Y == 0)break;

  counter=0;

  if(X < Y)swap(X,Y);

  while(Y != 0){
    X=X%Y;
    swap(X,Y);
    counter++;
  }
  
  cout <<X<<" "<<counter<<endl;
  
  } 

  return 0;
}