#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
  int X, Y;
  while(cin >> X >> Y){
    if(X == 0 && Y == 0) break;
    if(X < Y) swap(X, Y);
    int cnt = 0;
    while(Y != 0){
      cnt++;
      X %= Y;
      swap(X, Y);
    }

    cout << X << ' ' << cnt << endl;
  }
  return 0;
}