#include <iostream>

using namespace std;

int main(void){

  int x,y;

  while( cin >> x >> y , x || y ){

    int count = 0;
    while(y){
      int s = x % y;   
      int temp = y;
      y = s;
      x = temp;
      count++;
    }
    cout << x << " " << count << endl;
  }
  return 0;
}