#include<iostream>
#include<cstdio>
#include <cstring>
#include<map>
#include<string>
#include<stack>
using namespace std;

void gcd(int max , int *min, int *count){
int amari;
while(1)
{
*count+=1;
amari=max%*min;
if(amari==0) break;
max=*min;
*min=amari;
}}


int main(){
	int n,m,count=0;
	int a,b;
	while(cin>>n>>m)
	{
		if(n==0 && m==0) break;
		a = max(m,n);
		b = min(m,n);
		gcd( a , &b , &count);
		cout<< b<<' '<<count<<endl;
		count=0;
	}
}