#include <cstdio>
#include <algorithm>

int main()
{
	int x = 0, y = 0;
	int temp;
	int count;
	while (scanf("%d %d", &x, &y) != EOF) {
		if (x == 0 && y == 0) {
			break;
		}

		temp = 0;

		if (x < y) {
			temp = x;
			x = y;
			y = temp;
		}

		for (count = 0; y != 0; count++) {
			x = x % y;
			temp = x;
			x = y;
			y = temp;
		}

		printf("%d %d\n", x, count);

	}
	return 0;
}