#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

pii gcd(int a, int b, int c = 0) {
  return b == 0 ? pii(a, c) : gcd(b, a % b, c + 1);
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int a, b;
  while (cin >> a >> b, a) {
    if (a < b) swap(a, b);
    pii g = gcd(a, b);
    cout << g.first << " " << g.second << endl;
  }

  return 0;
}
