#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

struct A {
  int c;
  int s;
};

A g(int x, int y) {
  int count = 0;
  while(y > 0) {
    count++;
    x %= y;
    swap(x, y);
  }

  A a;
  a.c = count;
  a.s = x;
  return a;
}

int main() {
  int x, y;
  while(cin >> x >> y) {
    if(!x && !y) return 0;
    A a = g(max(x, y), min(x, y));
    cout << a.s << " " << a.c << endl;
  }
}