#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; ++i)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define P pair<int, int>

P check(int a, int b){
  if(b == 0) return P(a, 0);
  else{
    P tmp = check(b, a % b);
    tmp.second += 1;
    return tmp;
  }
}

int main() {
  int a, b;
  while(cin >>a >>b && a){
    if(a < b) swap(a, b);
    P ans = check(a, b);
    cout <<ans.first <<" " <<ans.second <<endl;
  }
  return 0;
}