#include <iostream>
using namespace std;

int stepCnt;
int gcd(int x,int y){stepCnt++;return y?gcd(y,x%y):x;}

int main(void){
  int a, b;
  
  while (cin >> a >> b){
    if (a==0 && b==0) break;
    if (a<b){
      stepCnt = a; a = b; b = stepCnt;
    }
    stepCnt = 0;
    cout << gcd(a,b) << " ";
    cout << (stepCnt-1) << endl;
  }
  return 0;
}
  
  

