#include<iostream>
using namespace std;

int main(){
	int x,y,step,tmp;
	while(true){
		cin >> x >> y;
		
		if(!x && !y)
			break;
			
		if(x < y){
			tmp = x;
			x = y;
			y = tmp;
		}
		step = 0;
		
		while(y != 0){
			step++;
			
			x = x%y;
			
			tmp = x;
			x = y;
			y = tmp;
			
			if(!y)
				break;
		}
		cout << x << ' ' << step << endl;
	}
}