#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;

int main()
{
  while(1) {
    int x, y, cnt = 0;
    cin >> x >> y;
    if(x == 0 && y == 0)
      break;
    if(x < y) swap(x, y);
    
    while(1) {
      cnt++;
      x %= y;
      swap(x, y);
      if(y == 0) break;
    }
    cout << x << ' ' << cnt <<endl;
  }
}