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 <cstdio>
#include <algorithm>
int ans = 0;
int GCD(int a, int b){
	if(b==0)return a;
	ans++;
	return GCD(b, a%b);
}

int main(){
	int x, y;
	while(scanf("%d %d",&x, &y), x+y){
		ans = 0;
		if(x < y)std::swap(x,y);
		int gcd = GCD(x, y);
		printf("%d %d\n", gcd, ans);
	}
}

C++: #include <iostream>
using namespace std;
int main()
{
	int x, y, c;
	while (cin >> x >> y && x && y)
	{
		if (x < y) swap(x, y);
		c = 0;
		while (y > 0)
		{
			x %= y;
			swap(x, y);
			c++;
		}
		cout << x << " " << c << endl;
	}
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
unsigned int a, b, temp, masatoy;
int main() {
	while (1) {
		cin >> a >> b;
		if (a == 0 && b == 0)return 0;
		if (a<b) {
			temp = b;
			b = a;
			a = temp;
		}
		while (b != 0) {
			a = a % b;
			temp = a;
			a = b;
			b = temp;
			masatoy++;
		}
		cout << a << " " << masatoy << endl;
		masatoy = 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==0)break;
    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 <stdio.h>
int main(void) {
	long a1, a2, x, y;
	int amari,i=0;
	scanf("%ld %ld", &a1, &a2);	//1. 2number
	if(m==0 && n==0)break;
	
	if(a1<a2){
		
		x = a2;
		y = a1;
	}	
	for(amari =! 0){
		amari = x % y;
		x = y;
		y = amari;
                i++;
	
	}
	
	printf("%ld %ld\n", x, i);
	
	return 0;
}

C++: #include <stdio.h>
int t;
void swap(int &a,int &b){
    int temp=a;
    a=b;
    b=temp;
    return ;
}
int gcd(int a,int b){
    t++;
    a=a%b;
    swap(a,b);
    if(b==0)return a;
    return gcd(a,b);
}
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 <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) break;
        counter = 0;
        cout<<gcd(a,b)<<" "<<counter<<endl;
     }
     return 0;
}

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)break;
        t=0;
        printf("%d %d\n",gcd(a,b),t);
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int x, y, a, i, r;
    cin >> x >> y;
    while(x != 0 || y != 0){
        i = 0;
        
        if(y > x){
            a = x;
            x = y;
            y = a;
        }

        while(y != 0){
            r = x % y;
            x = r;
            r = y;
            y = x;
            x = r;
            i++;
        }
        
        cout << x << " " << i << endl;
        cin >> x >> y;
    }
    
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int x,y,i;
int main(){
	while(cin>>x>>y&&x+y){
		if(y>x)swap(x,y);
		i=0;
		for(;y;i++){
			x%=y;
			swap(x,y);
		}
		cout<<x<<" "<<i<<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 ) {
			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>

using namespace std;

typedef long long ll;

int main()
{
    ll x, y, step;
    
    while(cin >> x >> y && x && y) {
        if(x < y) swap(x, y);
        step = 0;
        do {
            x = x % y;
            swap(x, y);
            step++;
        } while(y != 0);
        cout << x << " " << step << endl;
    }
    return 0;
}

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

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

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main() {
	while (1) {
		long long a, b, count = 0;
		cin >> a >> b;
		if (a == 0 && b == 0) return 0;
		if (a < b) swap(a, b);
		while (1) {
			count++;
			a = a%b;
			swap(a, b);
			if (b == 0) {
				cout << a << " " << count << endl;
				break;
			}
		}
	}
	return 0;
}

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() {
  int a, b;

  while( cin >> a >> b, a+b ) {
    step = 0;
    if( a < b ) swap( a, b );
    cout << gcd( a, b );
    cout << " " << step << endl;
  }
  
  return 0;
}

C++: #include <stdio.h>
int main(){
  long x,y,a,counter=0;

  while(1){
    scanf("%ld %ld",&x,&y);
    if(x==y==0)break;
    while(1){
      counter++;
      a=x%y;
      if(a==0)break;
      x=y;
      y=a;
    }
    printf("%ld %ld\n",y,counter);
    counter=0;
  }
  return 0;
}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int dx[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[8] = {0, -1, 0, 1, -1, 1, -1, 1};

int main() {
  int x, y;

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