#define scanf_s scanf
#include <stdio.h>
#include<iostream>
#include <list>
#include <vector>
#include <iostream>
using namespace std;
#define MAX 101

int main()
{
	while (1) {
		int X, Y, r, cou = 0;
		scanf_s("%d %d", &X, &Y);
		if (X == 0 && Y == 0) break;
		if (X < Y) {
			r = X;	X = Y; Y = r;
		}
		 do{
			r = X % Y;
			X = Y; Y = r;
			++cou;
		 } while (r != 0);
		printf("%d %d\n", X, cou);
	}
}