#include<iostream>
using namespace std;

int main() {
  int n,m,t,c;
  while(cin>>n>>m, n|m) {
    c = 0;
    if(m>n) swap(n,m);

    while(m>0) {
      n %= m;
      swap(n,m);
      c++;
    }
    cout<<n<<" "<<c<<endl;
  }
}