#include<bits/stdc++.h>
using namespace std;

int main(){
	int a,b;
	while(cin >> a >> b, a||b){

		int count=0;
		while(b!=0){
		a=a%b;
		swap(a,b);
		count++;

		}
	cout<<a<<" "<<count<<endl;
	}
	return 0;
}
