#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main(void)
{
	int result[10000], step[10000];
	int suffix = 0;

	while (1) {
		long long x, y;

		scanf("%lld", &x);
		scanf("%lld", &y);

		if (x == 0 && y == 0) {
			break;
		}

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


		long long value = 1;
		int count = 0;

		while (1) {
			count++;
			value = x % y;

			if (value == 0) {
				result[suffix] = y;
				step[suffix] = count;
				suffix++;
				break;
			}

			x = y;
			y = value;
		}
	}

	for (int i = 0; i < suffix - 1; i++) {
		printf("%d %d\n", result[i], step[i]);
	}

	printf("%d %d", result[suffix - 1], step[suffix - 1]);

	return 0;
}