#include<iostream>
#include<cstdio>
using namespace std;


int main(void)
{
  int a, b, x, y, z, i=0;

  scanf("%d %d", &a, &b);

  if(a != 0 && b != 0)
  {
    if(a >= b)
    {
      x = a;
      y = b;
    }

    else
    {
      x = b;
      y = a;
    }

  do{
      x = x%y;
      z = x;
      x = y;
      y = z;
      i++;
     }while(y!=0);

  printf("%d %d\n", x, i);
  }

  return 0;
}

