Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func gcd(x, y int) (int, int) {
	nSteps := 0
	for {
		if x < y {
			tmp := x
			x = y
			y = tmp
		}
		nSteps++
		if x%y == 0 {
			return nSteps, y
		}
		x = x % y
	}
}

func main() {
	scanner.Split(bufio.ScanWords)

	for {
		a, _ := nextInt()
		b, _ := nextInt()

		if a == 0 && b == 0 {
			break
		}

		nSteps, p := gcd(a, b)
		fmt.Println(p, nSteps)
	}
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 27;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)

typedef pair<P,Ps> PIS;
PIS team[10];

int main(){
	int a, b;
	while(cin >> a >> b && (a || b)){
		int cnt = 0;
		while(a > 0){
			if(b > a) swap(a, b);
			cnt++;
			a %= b;
		}
		cout << b << " " << cnt << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;

int main()
{
  int a, b;
  while(cin >> a >> b, a|b){
    int cnt = 0;

    if(a < b) swap(a, b);

    while(b){
      a = a%b;
      swap(a, b);
      cnt++;
    }

    cout << a << " " << cnt << endl;

  }

  return 0;

}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	long long X,Y,s,c=0;
	while(cin>>X>>Y){
		if(X==0 && Y==0) break;
		while(Y!=0){
			s = X % Y;
			X = s;
			swap(X,Y);
			c++;
		}
	cout<<X<<" "<<c<<endl;
	c=0;
	}
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int cnt;
    unsigned long long x,y,a;
    while(1){
        cnt = 0;
        cin >> x >> y;
        if(x == 0 && y == 0) break;
        y = min(x,y);
        x = max(x,y);
        while(y!=0){
            x %= y;
            a = x;
            x = y;
            y = a;
            cnt++;
        }
        cout << x << " " << cnt << endl;
    }
}

C++: #include <iostream>
#include <cstdio>
using namespace std;

int cnt;

int gcd(int a, int b){
  cnt++;
  if(b == 0) return a;
  else return gcd(b, a%b);
}

int main(){
  int n, m;
  while(cin >> m >> n){
    if(m == 0 && n == 0) break;
    cnt = -1;
    int g = gcd(m, n);
    cout << g << ' ' << cnt << endl;
  }
return 0;
}

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





int main(){
  long  x, y, s, t, u;

  while(1){
    s = 0;
    cin>>x>>y;
    if(x == 0 && y == 0) break;


    while(y != 0){
      x = x%y;
      t =max(x, y);
      u =min(x, y);
      x = t; y =u;
      s++;
    }

    cout<<x<<" "<<s<<endl;
    
  }

  
  return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
  long long int x,y;
  while(cin >> x >> y,x){
    int count=0;
    while(y){
      x=x%y;
      swap(x,y);
      count++;
    }
    cout << x << " " << count << endl;
  }
}

C++: #include<iostream>
#include<algorithm>
using namespace std;

int main(){
  
  int X,Y,counter;

  while(1){

  cin >>X>>Y;

  if(X == 0 && Y == 0)break;

  counter=0;

  while(Y != 0){
    X=X%Y;
    swap(X,Y);
    counter++;
  }
  
  cout <<X<<" "<<counter<<endl;
  
  }
  

  return 0;
}

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

int main()
{
  int a, b, x, y;
  while( cin >> a >> b, a+b ) {
    int cnt = 0;
    if( a >= b ) { 
      x = a;
      y = b;
    } else {
      x = b;
      y = a;
    }

    while( y ) {
      x = x % y;
      swap(x, y);
      cnt++;
    }

    cout << x << " " << cnt << endl;
  }

}

C++: #include <bits/stdc++.h>

using namespace std;

int main(){
	int x, y, rest, cnt;

	while (cin >> x >> y, x) {
		if (x < y) {
			rest = x;
			x = y;
			y = rest;
		}
		cnt = 0;
		while(true) {
			++cnt;
			rest = x%y;
			if (rest == 0) {
				break;
			}
			x = y;
			y = rest;
		}
		cout << y << " " << cnt << endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;

int main()
{

	int x,y;

	while(true){
		int z=0;
		int c=0;

		cin >> x >> y;
		if(x==0 && y==0)
			break;

		while(true){
			x = x % y;
			z = x;
			x = y;
			y = z;

			c++;			

			if(y==0)
				break;
		}

		cout << x << ' ' << c << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>

using namespace std;

int counter;

int gcd(int a, int b){
    int tmp;
    if(a>b){
       if (b == 0) return a;
       counter++;
       return gcd(b, a%b);}
    
    else if(a<b){
       if (a == 0) return b;
       counter++;
       return gcd(a, b%a);}

   }

int main(void){
   int a, b;
   

    while(cin>>a>>b){
       if(a == 0 && b == 0)    return 0;
       counter = 0;
       cout<<gcd(a,b)<<" "<<counter<<endl;
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

int ct=0;

int gcd(int a,int b){
	ct++;
	if(a%b==0)return b;
	return gcd(b,a%b);
}

int main(){
	int x,y;
	while(cin>>x>>y,x*y){
		cout<<gcd(x,y)<<" "<<ct<<endl;
		ct=0;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cassert>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

int cnt;

int gcd(int w,int m){
  if ( m ==0)return w;
  cnt++;
  return gcd(m,w%m);
}

int solve(int *a){
  cnt=0;
  cout << gcd(a[0],a[1])<<" " << cnt << endl;
}

main(){
  int a[2];
  while(cin>>a[0]>>a[1]){
    if ( a[0]==0&&a[1]==0)break;
    if ( a[0]<a[1])swap(a[0],a[1]);
    assert(a[0]>2 && a[1]>2);
    solve(a);
  }
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int a, b;
	while (cin >> a >> b, a || b) {
		int c = max(a, b), d = min(a, b);
		int r;
		int cnt(0);
		while (d) {
			cnt++;
			r = c%d;
			c = d;
			d = r;
		}
		cout << c << " " << cnt << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int a, b;
int co;

int gcd(int a, int b){
	if (b == 0)return a;
	co++;
	return gcd(b, a%b);
}

int main(){
	while (cin >> a >> b&&a+b){
		if (a < b)swap(a, b);
		co = 0;
		int ans = gcd(a, b);
		cout << ans << " " << co << endl;
	}
}