#include <bits/stdc++.h>
using namespace std;

#define FOR(i, x, y) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

int main()
{
  long long int x, y;
  while (cin >> x >> y, x + y){
    int cnt = 0;
    if (x < y) swap(x, y);
    while (y != 0){
      x = x % y;
      swap(x, y);
      cnt++;
    }
    cout << x << " " << cnt << endl;
  }
}