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<bits/stdc++.h>
using namespace std;
int main(){
	long long x, y;
	while(1){
		long count=0, tmp;
		cin>>x>>y;
		if(x < y){
			tmp = x, x = y,  y = tmp;
		}
		if(x == 0 && y == 0) break;
		while(1){
			if(y == 0) break;
				
				tmp = x % y;
				x = y;
				y = tmp;
				count++;
		}
		cout<<x<<" "<<count<<endl;
	}
	return 0;
}

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

int main(){


	int a,b,c,t;

	while(1){
	cin>>a>>b;
	if(a==0&&b==0){break;}
	c=0;
	t=0;
	int count=0;
	while(b!=0){
	c=a%b;
	a=c;
	t=a;
	a=b;
	b=t;
	count++;
	}
	cout<<a<<" "<<count<<endl;
	}
}

C++: #include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
double dp[200][100];//動的計画法
int main(){
    long long a,b,cnt,tmp;
    while(cin>>a>>b,a){
        cnt=0;
        while(b){
            a%=b;
            tmp=b;
            b=a;
            a=tmp;
            cnt++;
        }
        cout<<a<<" "<<cnt<<endl;
    }
}

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

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

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

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

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

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

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

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

typedef unsigned long long ull;
ull cnt;

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

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

C++: #include<iostream>
using namespace std;
int main(){
long n,x,y,z,k;
while(cin>>x>>y){
if(x==0)break;
if(x<y){z=x;x=y;y=z;}
k=0;
while(y>0){
x%=y;
z=x;x=y;y=z;
k++;
}
cout<<x<<" "<<k<<endl;
}
return 0;
}

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

using namespace std;;

int main(){
  long xbox[1000];
  long ybox[1000];
  int size=0;
  long xtemp,ytemp;
  long x,y,swap,mod;
  long step;
  
  while(true){
    scanf("%ld %ld", &xtemp,&ytemp);
    if(xtemp == 0 && ytemp == 0) break;
    if(x>y){
      xbox[size] = xtemp;
      ybox[size] = ytemp;
    }else{
      xbox[size] = ytemp;
      ybox[size] = xtemp;
    }
   
    size++;
    }
  for(int i=0; i<size; i++){
    step = 0;
    x = xbox[i];
    y = ybox[i];
    while(y!=0){
      mod = x%y;
      //printf("mod %d\n",mod);
      x = mod;
      swap = x;
      x = y;
      y = swap;
      step++;
    }
    printf("%ld %ld\n", x,step);
  }
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, n) &((x)[0]), &((x)[n])
#define SUBIF(a, b, x) ((x) ? (b) : (a))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define pb push_back
#define EPS (1e-20)
#define INF 2147483647LL
#define MOD 1000000007LL
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using namespace std;


int a, b;


PII solve(){
	if(a < b) swap(a, b);
	int cnt = 1;
	int r = a%b;
	while(r > 0){
		a = b;
		b = r;
		r = a%b;
		cnt++;
	}
	return { b, cnt };
}


int main(){
	while(cin >> a >> b, a && b){
		PII ans = solve();
		cout << ans.first << ' ' << ans.second << endl;
	}

	return 0;
}

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

using namespace std;

int counter = 0;

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

int main(void){
    int a, b;
     cin>>a>>b;
    cout<<gcd(a,b)<<" "<<counter<<endl;
     return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int x, y, tmp, c;
	
	while(1){
		cin >> x >> y;
		if(x == 0 && y == 0){
			break;
		}
		c = 0;
		if(x < y){
			tmp = x;
			x = y;
			y = tmp;
		}
		
		while(y > 0){
			tmp = x % y;
			x = y;
			y = tmp;
			c++;
		}
		
		cout << x << " " << c << endl;
	}
	
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main(void)
{
	int result[10000], step[10000];
	int suffix = 0;

	while (1) {
		long long x, y;

		scanf("%lld", &x);
		scanf("%lld", &y);

		if (x == 0 && y == 0) {
			break;
		}

		long long value = 1;
		int count = 0;

		while (1) {
			count++;
			value = x % y;

			if (value == 0) {
				result[suffix] = y;
				step[suffix] = count;
				suffix++;
				break;
			}

			x = y;
			y = value;
		}
	}

	for (int i = 0; i < suffix - 1; i++) {
		printf("%d %d\n", result[i], step[i]);
	}

	printf("%d %d", result[suffix - 1], step[suffix - 1]);

	return 0;
}

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

using namespace std;

int gcd(int a, int b, int &c){
  if(a>b) swap(a,b);
  if(a==0)return b;
  c++;
  return gcd(a, b%a, c);
}

int main(){
  int a,b,c;
  while(scanf("%d%d",&a,&b), a+b){
    c = 0;
    int d = gcd(a,b,c);
    printf("%d %d\n",d,c);
  }
  return 0;
}

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

int gcd(int a, int b, int cnt);

int main()
{
	int a, b;

	while (cin >> a >> b, a){
		int cnt = 0;
		gcd(max(a, b), min(a, b), cnt);
	}

	return (0);
}

int gcd(int a, int b, int cnt)
{
	if (b == 0){
		cout << a << " " << cnt << endl;
	}
	else {
		return (gcd(b, a % b, cnt + 1));
	}
}

C++: //

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>

using namespace std;

#define MAX -210000000
#define MIN 210000000

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

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