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++: #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)<<" "<<counter<<endl;
   }
   return 0;
}

C++: #include <iostream>

using namespace std;

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

void solve()
{
	int a, b;
	while(cin >> a >> b, a || b)
	{
		if(a < b)
		{
			swap(a, b);
		}
		int step = 0;
		cout << Euclid(a, b, step);
		cout << " " << step << endl;
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k;
	int x,y,cnt;
	
	while(1) {
		cin>>x>>y;
		if(x==0&&y==0) break;
		if(y>x) swap(x,y);
		cnt=0;
		while(y!=0) {
			cnt++;
			x=x%y;
			swap(x,y);
		}
		cout<<x<<" "<<cnt<<endl;
	}
}

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

int main(){

  unsigned long long int a,b,c,r,count;

  while(cin >> a >> b, a, b){
    count = 0;

    while(b!=0){

      c = a/b;
      r = a%b;
      a = b;
      b = r;

      count++;

    }

    cout << a << ' ' << count << endl;

  }
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){

	int x, y;
	while(1){
		cin >> x >> y;
		int tmp = max(x, y);
		y = min(x, y);
		x = tmp;
		if(x == y && x == 0)break;
		int cnt = 1;
		while(1){
			int ab = x % y;
			if(ab == 0){
				cout << y << " " << cnt << endl;
				break;
			}
			x = y;
			y = ab;
			cnt++;
		}
	}

	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

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

#define FOR(i, x, y) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

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

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

int main(){

  unsigned long long int a,b,c,r,count,x,y;

  while(cin >> x >> y, x, y){
    count = 0;

    a = max(x,y);
    b = min(x,y);
    while(b!=0){

      c = a/b;
      r = a%b;
      a = b;
      b = r;

      count++;

    }

    cout << a << ' ' << count << endl;

  }
}

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

int step=0;

int gcd(int x,int y){
	if(y==0)return x;
	else{
		step++;
		return gcd(y,x%y);
	}
}

int main(void){
	int x,y,ans;
	while(1){
		scanf("%d%d",&x,&y);
		if(x==0 && y==0)break;
		step=0;
		if(x>y)ans=gcd(x,y);else ans=gcd(y,x);
		cout << ans << " " << step << endl;
	}
	return 0;
}

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

using namespace std;

int ct;

int GCD(int m, int n);

int main()
{
	int m, n;
	
	while (cin >> m >> n, m, n){
		ct = 1;
		if (m < n){
			swap(m, n);
		}
		int gcd = GCD(m, n);
		cout << gcd << ' ' << ct << endl;
	}
	
	return (0);
}

int GCD(int m, int n)
{
	int r;
	
	while (m % n != 0){
		r = n;
		n = m % n;
		m = r;
		ct++;
    }
	
	return (n); 
}

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

int main()
{	
	long long x, y;

	cin >> x >> y;

	while (x > 0 || y > 0) {
		int i = 0;

		if (x < y)
			swap(x, y);

		while (y > 0) {
			x = x % y;
			swap(x, y);
			i++;
		}

		cout << x << " " << i << endl;

		cin >> x >> y;
	}
	
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  while(1){
    long long x,y,cnt=0;
    cin>>x>>y;
    if(x<y)swap(x,y);
    while(1){
      cnt++;
      x%=y;
      swap(x,y);
      if(y==0)break;
    }
    printf("%lld %lld\n",x,cnt);
  }
  return 0;
}

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;
  if(x < y) swap(x,y);
  p = 0;
  gcd(x,y);
  //cout << x << " " << p-1 << endl;
  //int tmp =gcd(x,y,p);
  //cout <<  tmp << " " << p << endl;
}
  return 0;
}

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

void greatestCommonDivisor(int x, int y);

int main(){
	int a, b;
	while(scanf("%d %d", &a, &b)){
		if(a == 0 and b == 0) break;
		greatestCommonDivisor(a, b);
	}
	return 0;
}

void greatestCommonDivisor(int x, int y){
	int temp, count = 0;
	while(y != 0){
		x %= y;
		temp = x;
		x = y;
		y = temp;
		count++;
	}
	printf("%d %d\n", x, count);
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>
#include<stack>
#include<queue>
#include<iostream>
using namespace std;
int main(void)
{
	int i,j,cnt,n,m;
	while(1) {
		cin>>n>>m;
		if(n==0&&m==0)break;
		if(n<m) swap(n,m);
		cnt=1;
		while(1) {
			n=n%m;swap(n,m);
			if(m==0) break;
			else cnt++;
		}
		cout<<n<<" "<<cnt<<endl;
	}
}

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

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

C++: #include<iostream>
using namespace std;
int main(){
  int x,y;

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

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