#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
int main(){
  while(true){
    ll a,b;
    cin >> a >> b;
    if(a == 0 && b == 0)return 0;
    ll A = max(a,b),B = min(a,b);
    int cnt = 0;
    while(A % B != 0){
      A = (A % B);
      swap(A,B);
      cnt++;
    }
    cout << B << " " << cnt + 1 << endl;
  }
  return 0;
}

