
#include<iostream>
using namespace std;

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