#include <iostream>
#include <cstdio>
using namespace std;

typedef unsigned long long ull;
ull cnt;

ull gcd(ull a, ull b){
  if(b == 0) return a;
  else{
    cnt++;
    return gcd(b, a%b);
  }
}

int main(){
  ull n, m;
  while(cin >> m >> n){
    if(m == 0 && n == 0) break;
    cnt = 0;
    ull g = gcd(m, n);
    cout << g << ' ' << cnt << endl;
  }
  return 0;
}