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

int res;

int gcd(int x, int y) {
  if(y == 0) return x;
  res++;
  return gcd(y,x%y);
}

int main() {
  int x,y;
  while(cin >> x >> y) {
    if(x==0 && y==0 || y==0) break;
    if(x < y) {
      swap(x,y);
    }
    res = 0;
    cout << gcd(x,y) << " " << res << endl;
  }
  return 0;
}