#include<bits/stdc++.h>
using namespace std;





int main(){
  long  x, y, s, t, u;

  while(1){
    s = 0;
    cin>>x>>y;
    if(x == 0 && y == 0) break;


    while(y != 0){
      x = x%y;
      t =max(x, y);
      u =min(x, y);
      x = t; y =u;
      s++;
    }

    cout<<x<<" "<<s<<endl;
    
  }

  
  return 0;
}

