#include<iostream>
using namespace std;

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

int main() {
  for(long long a, b; cin >> a >> b, (a || b); ) {
    cnt = 0;
    long long g = gcd(a, b);
    cout << g << " " << cnt << endl;
  }
}