#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
using namespace std;
int main(){
int a,b;
while(cin>>a>>b,a||b){
int co=0;
if(a<b)swap(a,b);
while(1){
if(b==0)break;
a=a%b;
swap(a,b);
co++;
}
cout<<a<<" "<<co<<endl;
}
}