#include<iostream>
using namespace std;
int main()
{
  int x,y;
  for(;cin>>x>>y,x;)
    {
      int step=0;
      for(;y!=0;step++)
        {
          x=x%y;
          swap(x,y);
        }
      cout<<x<<" "<<step<<endl;
    }
}