#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,m,n;
  while(cin>>a>>b,a||b){
    m = max(a,b);
    n = min(a,b);
    int count = 0;
    while(n!=0){
      int tmp = n;
      n = m%n;
      m = tmp;
      count++;
    }
    cout << m << " " << count << endl;
  }
  return 0;
}