//#include<bits/stdc++.h>
#include<iostream>
#include <vector>
#include <cstdio>
#include<algorithm>
#include <utility>
#define SIZE 1001;
using namespace std;
int main() {
	long long count=0, x, y;
	while (1) {
		cin >> x >> y;
		if (x == 0 && y == 0) {
			break;
		}
		if (y > x) {
			swap(x, y);
		}
		while (1) {
			if (y == 0) {
				break;
			}
			count++;
			x %= y;
			swap(x, y);
		}
		cout << x <<" "<<count<<  endl;
		count = 0;
	}
	return 0;
}