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>
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 (1) {
			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<cstdio>
#include<iostream>
using namespace std;
int main(void){
	int x,y,temp,cnt;
	while(1){
		cin>>x>>y;
		if(x+y==0)break;
		if(x<y){
			temp=x;
			x=y;
			y=temp;
		}
		cnt=0;
		while(1){
			x=x%y;
			temp=x;
			x=y;
			y=temp;
			cnt++;
			if(y==0) break;
		}
		cout<<x<<' '<<cnt<<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, 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<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

void Euclidean(long long a,long long b,long long n){
	if(b!=0) Euclidean(b,a%b,n+1);
	else cout<<a<<" "<<n<<endl;
	return;
}

int main(void){

	long long a,b;

	while(1){

		cin>>a>>b;
		if(a<b) swap(a,b);
		if(a==0&&b==0) break;
		if(b!=0) Euclidean(a,b,0);
		else cout<<"0 0"<<endl;
	}

    return 0;
}

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


int counter;

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

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 <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

ll s;

ll gcd(ll x, ll y) {
    if (x < y) swap(x, y);
    x %= y;
    swap(x, y);
    s++;
    return y ? gcd(x, y) : x;
}

int main() {
    ll a, b;
    while (cin >> a >> b && !(a == 0 || b == 0)) {
        s = 0;
        ll g = gcd(a, b);
        cout << g << ' ' << s << endl;
    }
}

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

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

void func(ll a, ll b, ll cnt) {
	if (!b)cout << a << ' ' << cnt << endl;
	else func(b, a%b, cnt + 1);
}
int main() {
	ll a, b;
	while (cin >> a >> b, a | b) {
		if (a < b)swap(a, b);
		func(a, b, 0);
	}
}

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

int main(){
	while(1){
		unsigned int a, b;
		cin >> a >> b;
		if(a == 0 && b == 0) break;
		if(a < b) swap(a, b);
		int ans = 0;
		while(b != 0){
			int temp = a;
			a = b;
			b = temp % b;
			ans++;
		}
		cout << a << ' ' << ans << endl;
	}
	
	return 0;
}

C++: #include<iostream>

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<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}


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

C++: #include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()

int cnt;
int main(void){
  int a,b;
  while(cin>>a>>b,a+b){
    cnt = 0 ;
    if(a<b){
      int tmp = a;
      a = b;
      b = tmp;
    }
    int tmp;
    while(b!=0){
      cnt ++;
      //cout << a <<" " << b << endl;
      tmp = a % b;
      a = b;
      b = tmp;
    }
    cout<< a <<" "<< cnt << endl;
  }
}

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

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);}
    
    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;

void gcd(int a, int b, int step);

int main()
{
	int a, b;

	while (cin >> a >> b, a){
		gcd(a, b, 0);
	}

	return (0);
}

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

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

pair< unsigned, unsigned > rec(unsigned X, unsigned Y, unsigned Step)
{
  if(Y == 0) return(make_pair(X, Step));
  else return(rec(Y, X % Y, Step + 1));
}

int main()
{
  unsigned X, Y;
  while(cin >> X >> Y, X|Y) {
    pair< unsigned, unsigned > ret = rec(X, Y, 0);
    cout << ret.first << " " << ret.second << endl;
  }
}

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

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

C++: #include<iostream>
main(){for(int a,b,t,c;std::cin>>a>>b,a;printf("%d %d\n",a,c)){if(a<b)std::swap(a,b);for(c=0;t=b;a=t,c++)b=a%b;}}

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

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
using namespace std;
typedef long long  ll;
const int MAX = 10000;
typedef pair<int, int> P;
/** Problem0197 : Greatest Common Divisor : Euclidean Algorithm **/
int main()
{
	int a, b;
	
	while (cin >> a >> b, a!=0 && b!=0) {
		int i=0;
		while (1) {
			if (a < b)
				swap(a, b);
			a = a%b;
			i++;
			
			if (a==0)
				break;
			
		}
		cout << b << " " << i << endl;
	}
}