Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		buf := strings.Split(scanner.Text(), " ")
		a, _ := strconv.Atoi(buf[0])
		b, _ := strconv.Atoi(buf[1])
		if a == 0 && b == 0 {
			break
		}
		if a < b {
			a, b = b, a
		}
		cnt := 0
		for b != 0 {
			a = a%b
			a, b = b, a
			cnt++
		}
		fmt.Println(a, cnt)
	}
}

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

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

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

using namespace std;

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

int main(void){
  int a,b;
  while(cin>>a>>b,a+b){
    step = 0;
    cout<<gcd(max(a,b),min(a,b));
    cout<<" "<<step<<endl;
  }
}

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

int main(){
	int a,b;
	while(1){
		cin>>a>>b;
		if(a==0 && b==0){break;}

		int count=0;
		while(b!=0){
		a=a%b;
		swap(a,b);
		count++;

		}
	cout<<a<<" "<<count<<endl;
	}
	return 0;
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return !odd(n); }
template<typename V> typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

int gcd(int x, int y, int &t) {
  if (x < y) swap(x, y);
  while (y) x %= y, swap(x, y), t++;
  return x;
}

void solve() {
  int a, b;
  while (cin >> a >> b, a) {
    int t = 0;
    cout << gcd(a, b, t) << ' ' << t << endl;
  }
}

C++: #include <stdio.h>
int t;
void swap(int &a,int &b){
    int temp=a;
    a=b;
    b=temp;
    return ;
}
int gcd(int x, int y) {
    if(x == 0) return y;
    if(y == 0) return x;
    t++;
    if(x > y) return gcd(y, x % y);
    return gcd(x, y % x);
}
int main(){
    int a,b;
    while(true){
        scanf("%d%d",&a,&b);
        if(a==0&&b==0)return 0;
        t=0;
        //if(a<b)swap(a,b);
        printf("%d %d\n",gcd(a,b),t);
    }
}

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

int step;
int res;
int gcd(int a,int b){
  if(b==0){
   return a;
  }
  res = max(res,++step);
  return gcd(b,a%b);
}
int main(void){
  int a,b;
  while(cin>>a>>b,a+b){
    step = res = 0;
    cout<<gcd(a,b)<<" ";
    cout<<res<<endl;;
  }
}

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

int p = 0;

void gcd(int x,int y){
  p++;
  if(y == 0){
    cout<<x<<' '<<p-1<<endl;
    return;
  }

  gcd(y,x%y);
}

int main(){

while(1){
  int x,y;
  cin >> x >> y;
  if(x == 0 && y == 0)break;
  p = 0;
  gcd(x,y);
  //cout << x << " " << p-1 << endl;
  //int tmp =gcd(x,y,p);
  //cout <<  tmp << " " << p << endl;
}
  return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(){
  int x;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){

    } else if ( s[0] == '-' ){

    } else if ( s[0] == '*' ){

    } else {
      x = atoi(s);

    }
  }

  return 0;
}

C++: #include<iostream>

using namespace std;

typedef long long ll;

int ct=0;

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

int main(){
	ll x,y;
	while(1){
		cin >> x >> y;
		if(x==0 && y==0)break;
		if(x<y){
			ll tmp=x;
			x=y;
			y=tmp;
		}
		cout<<gcd(x,y)<<" "<<ct<<endl;
		ct=0;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int counter;
int gcd(int a, int b)
{       if (b == 0) return a;
       counter++;
       return gcd(b, a%b);
   }
   
int main(void){
   int a, b, x;
    while(cin>>a>>b){
        if(a < b){
            x = a;
            a = b;
            b = x;
        }
        if(a == 0 && b == 0)
    return 0;
        counter = 0;
        cout<<gcd(a,b)<<" ";
       cout<<counter<<endl;
    }
    return 0;
}

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

using namespace std;

pair<int, int> euc_gcd(int a, int b){

    int c, step = 0;

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

    while(b > 0){
		step++;
        c = a % b;
        a = b;
        b = c;
    }

    return make_pair(a, step);
}

int main(){

	int a, b;

	while(cin>>a>>b, (a||b)){
		
		pair<int, int> t = euc_gcd(a, b);
		cout << t.first << " " << t.second << endl;
	}

	return 0;
}

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

C++: #include <stdio.h>
int X, Y, T;
int gcd(int x, int y) {
	if(x == 0) return y;
	if(y == 0) return x; T++;
	if(x > y) return gcd(y, x % y);
	return gcd(x, y % x);
}
int main() {
	while(true) {
		scanf("%d%d", &X, &Y); T = 0;
		if(X == 0 && Y == 0) break;
		printf("%d %d\n", gcd(X, Y), T);
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

int depth;

long long int GCD(long long int a, long long int b){
	depth++;
	long long int rest = a % b;
	a = rest;
	swap(a, b);
	if(b == 0){
		return a;
	}
	return GCD(a, b);
}

int main(){
	
	long long int a, b;
	
	while(true){
		
		cin >> a >> b;
		
		if(a == 0 && b == 0){
			break;
		}
		
		depth = 0;
		
		if(a < b){
			swap(a, b);
		}
		
		long long int ans = GCD(a, b);
		
		cout << ans << " " << depth << endl;
		
	}
	
	return 0;
}

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

int main() {
    long long int N, M;
    while (cin >> N >> M, N || M) {
        int count = 0;
        while (M) {
            int tmp = N % M;
            N = M;
            M = tmp;
            count++;
        }

        cout << N << " " << count << endl;
    }

    return 0;
}

C++: #include<stdio.h>

int main(){
	int a,b;
	while(1){
		scanf("%d%d",&a,&b);
		if(!(a|b))return 0;
		int now=0;
		if(a<b){
			int c=a;
			a=b;
			b=c;
		}
		while(b!=0){
			a=a%b;
			int c=a;
			a=b;
			b=c;
			now++;
		}
		printf("%d %d\n",a,now);
	}
}

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

int x,y;

void swap(){
  int temp;
  temp = x;
  x = y;
  y = temp;
}

int main(){

  while(cin >> x >> y){
    if(x < y) swap();
    int count=0, temp;
    if(x==0 && y==0) break;
    while(y!=0){
      count++;
      x = x % y;
      swap();
    }
    cout << x  << ' ' << count << endl;
  }
  return 0;
}