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


int main(){
  int a,b,X,Y,ans;

  while(true){
    ans = 0;
    cin >> a >> b;
    if( a + b == 0) break;

    X = max(a,b);
    Y = min(a,b);
    int work;
    while(true){
      X = X % Y;
      work = Y;
      Y = X;
      X = work;
      ++ans;
      if(Y == 0) break;
    }

    cout << X << " " << ans << endl;
  }
  return 0;
}

