#include<iostream>

using namespace std;

void swap(int&, int&);

int main(){
  int count;
  long x, y;

  while(1){
    cin >> x >> y;
    if(x == 0 && y == 0) break;

    if(x < y) swap(x, y);
    count = 0;
    while(y != 0){
      x %= y;
      swap(x, y);
      ++count;
    }

    cout << x << " " << count << endl;
  }
  return 0;
}

void swap(int& x, int& y){
  int z;
  z = x;
  x = y;
  y = z;
}