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

int main()
{
  int a, b;
  while(cin >> a >> b, a|b){
    int cnt = 0;

    if(a < b) swap(a, b);

    while(b){
      a = a%b;
      swap(a, b);
      cnt++;
    }

    cout << a << " " << cnt << endl;

  }

  return 0;

}

