#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()

int cnt;
int main(void){
  int a,b;
  while(cin>>a>>b,a+b){
    cnt = 0 ;
    if(a<b){
      int tmp = a;
      a = b;
      b = tmp;
    }
    int tmp;
    while(b!=0){
      cnt ++;
      //cout << a <<" " << b << endl;
      tmp = a % b;
      a = b;
      b = tmp;
    }
    cout<< a <<" "<< cnt << endl;
  }
}