#include <stdio.h>
#include <math.h>

int main(void) {
	int a, b, n;
	int x, step;
	for (;;) {
		scanf("%d", &a);
		scanf("%d", &b);
		if (a >= 2 && a <= (pow(2.0, 31.0) - 1) && b >= 2 && b <= (pow(2.0, 31.0) - 1)) {
			if (a < b) {
				x = a;
				a = b;
				b = x;
			}
			step = 1;
			if (a != 0 && b != 0) {
				while (a%b != 0) {
					x = a % b;
					a = b;
					b = x;
					step++;
				}
				printf("%d %d\n", b, step);
			}

			else break;
		}
		else break;
	}
		
		

		return 0;
}
