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

int main(){

  int x,y,x1,y1;
  int cnt=0;

  while(1)
    {
      cin >> x >> y;

      if(x==0 && y==0)
	{
	  break;
	}

      /* x = max(x,y);
	 y = min(x,y);*/

      while(1)
	{
	  if(x!=y)
	    {
	      y1 = x%y;
	      x1 = y;
	      cnt++;
	      x = x1;
	      y = y1;
	      if(y == 0)break;
	    }
	  else
	    {
	      cnt = 1;
	      break;
	    } 
	}
      cout << x << " " << cnt << endl;
    }

