#include<iostream>
using namespace std;

int main(){

  unsigned long long int a,b,c,r,count;

  while(cin >> a >> b, a, b){
    count = 0;

    while(b!=0){

      c = a/b;
      r = a%b;
      a = b;
      b = r;

      count++;

    }

    cout << a << ' ' << count << endl;

  }
}