#include<iostream>
#include<cstdio>
#include<algorithm>
#include<functional>

using namespace std;

int gcd(int a, int b, int &c){
  if(a>b) swap(a,b);
  if(a==0)return b;
  c++;
  return gcd(a, b%a, c);
}

int main(){
  int a,b,c;
  while(scanf("%d%d",&a,&b), a+b){
    c = 0;
    int d = gcd(a,b,c);
    printf("%d %d\n",d,c);
  }
  return 0;
}