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

int main() {
  int x, y;
  while (cin >> x >> y, x | y) {
    if (x < y) {
      int tmp = x;
      x = y;
      y = tmp;
    }
    int cnt = 0;
    while (y) {
      int r = x % y;
      x = y;
      y = r;
      cnt++;
    }
    cout << x << " " << cnt << "\n";
  }
}
