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