#include<iostream>
#include<cstdio>

using namespace std;

void change(int *, int *);

int main(void)
{
	int x, y;
	
	while(scanf("%d %d", &x, &y)){
		int count = 0;
		if(x < y)
			change(&x, &y);
		while(y){
			count++;
			x %= y;
			change(&x, &y);
		}
		cout << x << ' ' << count << endl;
	}
	return 0;
}

void change(int *a, int *b)
{
	int temp;
	temp = *a;
	*a = *b;
	*b = temp;
	
}