#include<bits/stdc++.h>
using namespace std;
int N,M;
int main()
{
	while(true){
		scanf("%d%d",&N,&M);
		if(N<M)swap(N,M);
		if(N==0&&M==0)return 0;
		int cou=0;
		while(true){
			cou++;
			int M1=N%M;
			int N1=M;
			N=N1;M=M1;
			if(M==0)break;
		}
		printf("%d %d\n",N,cou);
	}
}