#include <bits/stdc++.h>

using namespace std;

int main(){

  int X,Y,c=0;

  while(true){
    cin>>X>>Y;
    if(X+Y==0) break;
    c=0;
    while(true){
      X %= Y;
      swap(X,Y);
      ++c;
      if(Y==0){
	cout << X << " " << c << endl;
	break;
      }
    }
  }

  
  return 0;
}

