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


int count = 0;

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

int main(){

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

  cout << gcd(x,y) << " " << count << endl;

}
  return 0;
}

