#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,r,count;
  while(1){
    count = 0;
    cin >> a >> b;
    if(a==0 && b==0) break;
    if(a<b) swap(a,b);
    while(b>0){
      r = a % b;
      a = b;
      b = r;
      count++; 
    }
    cout << a << " " << count << endl;
  }
  return 0;
}

