#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<30;

typedef pair<int,int> pii;

pii gcd(int a, int b) {
  if (b == 0) {
    return pii(a, 0);
  }
  pii p = gcd(b,a%b);
  return pii(p.first, p.second + 1);
}

int main() {
  int a, b;
  while(cin >> a >> b, a||b) {
    pii p = gcd(a,b);
    cout << p.first << " " << p.second << endl;
  }
}