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

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

int main() {
	int a,b;
	
	while(cin >> a >> b){
		if(a == 0 && b == 0) break;
		int count = 0;
		if(b<a){
			int temp = b;
			b = a;
			a = temp;
		}
		while(a != 0){
			int temp = a;
			a = b%a;
			b = temp;
			count++;
		}
		cout << b << " " << count << endl; 
	}
	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;
        while(cin>>a>>b){  
            if(a == 0 && b == 0) 
            return 0;        
            counter = 0;     
            cout<<gcd(a,b)<<" ";
            cout<<counter<<endl;   
            }  
            return 0;
        
}

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

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> VI;
typedef pair<int,int> PII;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;

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

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

int x,y;

int gcd(int a,int b,int& t){
	t++;
	if(!b) return a;
	return gcd(b,a%b,t);
}

int main(){
	while(1){
		cin>>x>>y;
		if(!x&&!y) break;
		int t=0;
		cout<<gcd(x,y,t)<<' ';
		cout<<t-1<<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;

  if(X < Y)swap(X,Y);

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

  return 0;
}

C++: #include<iostream>

unsigned int c;

unsigned int gcd(unsigned int X, unsigned int Y){
	unsigned x, y;
	if(Y > X)
		x = Y, y = X;
	else
		x = X, y = Y;
	x = x%y;
	unsigned tmp = x;
	x = y;
	y = tmp;
	c++;
	if(y == 0)
		return x;
	return gcd(x, y);
}

int main(){
	unsigned int x, y;
	while(true){
		c = 0;
		std:: cin >> x >> y;
		if(x == 0 && y==0)
			return 0;
		std:: cout << gcd(x, y) << ' ' << c << std::endl;
	}
}

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

int main(){
	int x, y, tmp, count;
	while(cin>>x>>y, x&&y){
		if(x<y){
			tmp=x;
			x=y;
			y=tmp;
		}
		count=0;
		while(y!=0){
			x %= y;
			tmp=x;
			x=y;
			y=tmp;
			count++;
		}
		printf("%d %d\n", x, count);
	}
	return 0;
}

C++: #include <stdio.h>
int X, Y, T, R;
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) return 0;
		R = gcd(X, Y);
		printf("%d %d\n", R, T);
	}
}

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

typedef long long ll;

int ct=0;

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

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

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
const double PI = acos(-1);

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

C++: #include<iostream>
using namespace std;
int main() {
	int a, b, r, kouyaku[1001], kazu[1001], kaisuu, s;
	kaisuu = 0;
	while (1) {
		cin >> a >> b;
		if (a == 0 && b == 0) {
			goto aa;
		}
		kaisuu = kaisuu + 1;
		s = 0;
		while (b!=0) {
			s = s + 1;
			r = a % b;
			a = b;
			b = r;
		}
		kouyaku[kaisuu] = a;
		kazu[kaisuu] = s;
	}
aa:;
	for (int i = 1; i <= kaisuu; i++) {
		cout << kouyaku[i] << " " << kazu[i] << endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int a,b;

void gcd(int a,int b,int c){
	if(!b)cout<<a<<" "<<c<<endl;
	else gcd(b,a%b,++c);
}

int main(){
	while(cin>>a>>b){
		if(!a)return 0;
		gcd(max(a,b),min(a,b),0);
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
unsigned int s,a,b;
unsigned int gcd(int x,int y){
	x=x%y; swap(x,y); s++;
	return y?gcd(x,y):x;
}
int main(){
	while(cin>>a>>b,a){
		s=0;
		if(a<b)swap(a,b);
		cout<<gcd(a,b)<<" "<<s<<endl;
	}
	return 0;
}

C++: #include <iostream>

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)    break;
       counter = 0;
       cout<<gcd(a,b)<<" "<<counter<<endl;
   }
   return 0;
}