# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
const double PI = acos(-1);

int main() {
	int a, b;
	while (cin >> a >> b &&a&&b) {
		if (a < b)swap(a, b);
		int count = 0;
		while (b){
			count++;
			int num = a;
			a = b;
			b = num%b;
		}
		cout << a << " " << count << endl;
	}
}