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

int cnt;

int gcd(int a, int b){
  cnt++;
  if(b == 0) return a;
  else return gcd(b, a%b);
}

int main(){
  int n, m;
  while(cin >> m >> n){
    if(m == 0 && n == 0) break;
    cnt = -1;
    int g = gcd(m, n);
    cout << g << ' ' << cnt << endl;
  }
return 0;
}