#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n) 

int main(void){  
  int a,b,n,m;
  while(cin>>a>>b, a){
    int count = 0;
    n = max(a,b);
    m = min(a,b);
    while(m){
      int tmp = m;
      m = n % m;
      n = tmp;
      count++;
    }
  cout << n <<" " << count << endl;
  }

}