#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
	int x,y;
	while(1){
		cin>>x>>y;
		if(x==0 && y==0) break;
		if(y>x){
			int t = x;
			x = y;
			y = t;
		}
		int step=0;
		while(y!=0){
			x = x%y;
			int t = x;
			x = y;
			y = t;
			step++;
		}
		cout<<x<<" "<<step<<endl;
	}

	return 0;
}