#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}


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

