#include <stdio.h>

void gcd(int x, int y, int c){
  if(y == 0){
    printf("%d %d\n", x, c);
    return;
  }
  gcd(y, x % y, c + 1);
}

int main(){
  int x, y;
  while(scanf("%d%d", &x, &y) && x && y){
    if(x < y){ x += y; y = x - y; x -= y;}
    gcd(x, y, 0);
  }
  return 0;
}