#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  unsigned int c,x,y;
  for(;;){
    cin>>x>>y;
    if(x+y==0)
      break;
    if(x<y)
      swap(x,y);
    for(c=0;y;c++){
      x%=y;
      swap(x,y);
    }
    cout<<x<<" "<<c<<endl;
  }
  return 0;
}