#include <iostream>
using namespace std;


int main() {
  int a, b;
  while (1) {
    cin >> a >> b;
    if (!a && !b) {
      break;
    }
    int d = 0;
    if (a < b) {
      int c = a;
      a = b;
      b = c;
    }
    while (b) {
      int c = a % b;
      a = b;
      b = c;
      ++d;
    }
    cout << a << " " << d << endl;
  }
  return 0;
}