#include<bits/stdc++.h>
using namespace std;

int main()
{
  int a, b, x, y;
  while( cin >> a >> b, a+b ) {
    int cnt = 0;
    if( a >= b ) { 
      x = a;
      y = b;
    } else {
      x = b;
      y = a;
    }

    while( y ) {
      x = x % y;
      swap(x, y);
      cnt++;
    }

    cout << x << " " << cnt << endl;
  }

}