#include<iostream>
#include<utility>
using namespace std;

int main(){
  int x,y,tmp;
  while(1){
    cin >> x >> y;
    if(x == 0 && y == 0) break;
    if(x < y) swap(x,y);
    int cou = 0;
    while(y != 0){
      tmp = x % y;
      x = tmp;
      swap(x,y);
      cou++;
    }
    cout << x << " " << cou << endl;
  }
}