#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  unsigned long long int x,y;
  while(cin >> x >> y,x){
    unsigned long long step=0;
    while(y){
      x=x%y;
      swap(x,y);
      step++;
    }
  cout << x << " " << step << endl;
  }
}