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

int main() {
  for(int X, Y; cin >> X >> Y && (X|Y);) {
    if(X < Y) swap(X, Y);
    int t = 0;
    for(; Y; ++t) {
      X = X % Y;
      swap(X, Y);
    }
    cout << X << " " << t << endl;
  }
  return 0;
}