#include <stdio.h>

int main(void)
{
    int a, b, r;
    int count = 1;
    
    while(scanf("%d %d", &a, &b) != EOF) {
        if(a == 0 && b == 0) {
            break;
        }
        
        while( (r = a % b) != 0 ) {
            
            a = b;
            b = r;
            count++;
            
        }
        printf( "%d %d\n", b, count );
    }
    
    return 0;
}

