#include <iostream>
#include <algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)
int x,y;
void solve() {
  int step = 0;
  if (x < y) swap(x,y);
  while (y != 0) {
    x = x % y;
    swap(x,y);
    step++;
  }
  cout<<x<<" "<<step<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>x>>y, x||y) {
    solve();
  }
  return 0;
}