#include <iostream>
using namespace std;
int cnt;

int GCD(int n, int m)
{
  cnt++;
  if (m % n == 0) return n;
  return GCD(m % n, n);
}

int main()
{
  int n, m;
  while (cin >> n >> m && n + m != 0){
    cnt = 0;
    if (n > m){
      int c = n;
      n = m;
      m = c;
    }
    cout << GCD(n, m) << " " << cnt << endl;
  }
}