#include <iostream>
using namespace std;

int main()
{
  int x, y;
  int c, i;

  while (cin >> x >> y && x != 0){
    if (x < y){
      c = x;
      x = y;
      y = c;
    }

    for (i = 0; y != 0; i++){
      x = x % y;
      c = x;
      x = y;
      y = c;
    }

    cout << x << " " << i << endl;
  }
}