#include <stdio.h>
int ans;int gcd(int a, int b) {if (a<b) a+=b,b=a-b,a-=b;if (!b) return a;a%=b,ans++;return gcd(a,b);}
int main() {int a,b;while (scanf("%d %d",&a,&b)!=EOF && (a || b)) ans=0,a=gcd(a,b),printf("%d %d\n",a,ans);return 0;}