#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<utility>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+9
#define EPS 1e-9
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = j; i < (k); i++)
typedef long long ll;
int cnt;
int func(int x,int y){
    if(x%y == 0)return y;
    ++cnt;
    func(y,x%y);
}
int main(){
    int x,y;
    while(scanf("%d%d",&x,&y),(x|y)){
        cnt = 0;
        if(x < y)swap(x,y);
        int ans = func(x,y);
        printf("%d %d\n",ans,cnt+1);
    }
    return 0;
}