#include<iostream>
using namespace std;

int x,y;

void swap(){
  int temp;
  temp = x;
  x = y;
  y = temp;
}

int main(){

  while(cin >> x >> y){
    if(x < y) swap();
    int count=0, temp;
    if(x==0 && y==0) break;
    while(y!=0){
      count++;
      x = x % y;
      swap();
    }
    cout << x  << ' ' << count << endl;
  }
  return 0;
}