#include<iostream>
#include<algorithm>
using namespace std;
int x,y,z;
int swap(){
  z = x;
  x = y;
  y = z;
  return 0;
}

int main(){
  while(true){
    cin>>x>>y;
    if(!x&&!y)break;
    int step = 0;
    if(y>x)swap();
    while(y!=0){
      x = x%y;
      swap();
      step++;
    }
    cout<<x<<" "<<step<<endl;
  }
  return 0;
}