#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  while(1){
    long long x,y,cnt=0;
    cin>>x>>y;
    if(x+y==0)break;
    if(x<y)swap(x,y);
    while(1){
      cnt++;
      x%=y;
      swap(x,y);
      if(y==0)break;
    }
    printf("%lld %lld\n",x,cnt);
  }
  return 0;
}