#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int gcd(int x,int y){
	return y ? gcd(y,x%y)+1 : 0;
}
int main(){
	int x,y;
	while(cin >> x >> y && (x||y)){
		if( x < y ) swap(x,y);
		cout << __gcd(x,y) << " " << gcd(x,y) << endl;	
	}
}