#include <iostream>
using namespace std;

int main(void){
  int i,x,y;

  while(1){
    cin>>x>>y;
    if(!x && !y) break;

    if(x<y) swap(x,y);
    for(i=0;y;i++){
      x = x % y;
      swap(x,y);
    }
    cout<<x<<" "<<i<<endl;
  }

  return 0;
}