
#include<iostream>
using namespace std;

int cnt;

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

int main()
{
  int a, b;
  while (cin>>a>>b, a||b) {
    if (a > b) {
      a ^= b;
      b ^= a;
      a ^= b;
    }
    cnt = 0;
    cout<<euclid(a, b)<<" "<<cnt<<endl;
  }
  return 0;
}