#include <bits/stdc++.h>

using namespace std;;

int main(){
  long xbox[1000];
  long ybox[1000];
  int size=0;
  long xtemp,ytemp;
  long x,y,swap,mod;
  long step;
  
  while(true){
    scanf("%ld %ld", &xtemp,&ytemp);
    if(xtemp == 0 && ytemp == 0) break;
    xbox[size] = xtemp;
    ybox[size] = ytemp;
    //printf("%d %d\n", xbox[size],ybox[size]);
    size++;
    }
  //size=1;
  //xbox[0] = 1071;
  //ybox[0] = 1029;
  for(int i=0; i<size; i++){
    step = 0;
    x = xbox[i];
    y = ybox[i];
    while(y!=0){
      mod = x%y;
      //printf("mod %d\n",mod);
      x = mod;
      swap = x;
      x = y;
      y = swap;
      step++;
    }
    printf("%ld %ld\n", x,step);
  }
}

