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 <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>
#include <algorithm>
using namespace std;

int main()
{
  int X, Y;
  while (cin >> X >> Y) {
    if ((X|Y) == 0)
      break;

    int cnt = 0;
    if (X < Y)
      swap(X, Y);

    do {
      X = X % Y;
      swap(X, Y);
      ++cnt;
    } while (Y != 0);

    cout << X << " " << cnt << endl;
  }
  return 0;
}

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

using namespace std;

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

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





int main(){
  int x, y, s;

  while(1){
    s = 0;
    cin>>x>>y;
    if(x == 0 && y == 0) break;


    while(y != 0){
      x = x%y;
      swap(x, y);
      s++;
    }

    cout<<x<<" "<<s<<endl;
    
  }

  
  return 0;
}

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

int main() {
	int a, b;
	while (cin >> a >> b,a,b) {
		int s = 0;

		if (a < b) { swap(a, b); }
		while (b!=0) {
				int c = a%b;
				a = b;
				b = c;
				s++;			
		}
		cout << a << ' ' << s << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
	for (int i = 0; i < 1000; i++){
		int a,b;
		cin >> a >> b;

		if (a == 0)
			if (b == 0)
				break;

		int r,COUNT = 1;

		while((r = a % b) != 0)
			{ a = b; b = r; COUNT++;}

		cout << b << " " <<COUNT << endl;
	}

	return 0;
}

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

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

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int X,Y,s,c=0;
	while(cin>>X>>Y){
		while(Y!=0){
			s = X % Y;
			X = s;
			swap(X,Y);
			c++;
		}
	cout<<X<<" "<<c<<endl;
	c=0;
	}
}

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

int X, Y;

pair<int, int> gcd_cnt(int x, int y){
    int cnt = 0;
    while(y > 0){
        cnt++;
        x %= y;
        swap(x, y);
    }
    return make_pair(x, cnt);
}

int main(){
    while(cin >> X >> Y){
        if(X == 0 && Y == 0){
            return 0;
        }
        pair<int, int> ret = gcd_cnt(X, Y);
        cout << ret.first << " " << ret.second << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	long long a,b;
	while(cin>>a>>b){
		if(a==0&&b==0)break;
		long long cnt=0;
		while(b!=0){
			a=a%b;
			swap(a,b);
			cnt++;
		}
		cout<<a<<" "<<cnt<<endl;
	}
	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) break;
		R = gcd(X, Y);
		printf("%d %d\n", R, T);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		if(!a&&!b)break;
		int x=(a>=b)?a:b,y=(a>=b)?b:a,step=0,tmp;
		while(y!=0){
			x=x%y;
			tmp=x;
			x=y;
			y=tmp;
			++step;
		}
		cout<<x<<" "<<step<<"\n";
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(void){
	int x,y,t;
	while(1){
		int i=0;
		cin >> x >> y;
		if(x == 0 && y == 0) break;
		else if(x < y){
			t = x;
			x = y;
			y = t;
		}while(y !=0){
			x %=y;
			t = x;
			x = y;
			y = t;
			i +=1;
		}cout << x << " " << i << endl;
		
	}
}

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;
		if(x<y) swap(x,y);
		cout<<gcd(x,y,t)<<' ';
		cout<<t-1<<endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(void){
   int x, y, temp;
   if (x < y){
       temp = x;
       x = y;
       y = temp;
   }
   
   while (y != 0){
       temp = y;
        y = x % y;
        x = temp;
   }
   return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main() {
	int a, b;
	int temp,masatoy=0;
	while (1) {
		cin >> a >> b;
		if (a == 0 && b == 0)return 0;
		while (b != 0) {
			a = a % b;
			temp = a;
			a = b;
			b = temp;
			masatoy++;
		}
		cout << a <<" "<<masatoy<< endl;
		masatoy = 0;
	}
}

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

int main(){
  int a,b,c,d,cou;
  while(1){
    cin >>a >>b;
    if(b>a)swap(a,b);
    if(a==0&&b==0)break;
    cou=1;
    while(1){
      if(a%b==0)break;
      d=a%b;
      a=b;
      b=d;
      cou++;
    }
    cout <<b<<" "<<cou<<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<y) swap(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 <algorithm>
using namespace std;

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int x, y;
	while(cin >> x >> y && !(x == 0 && y == 0)){
		cnt = 0;
		if(x < y) swap(x, y);
		cout << gcd(x, y) << " ";
		cout << cnt << endl;
	}

	return 0;
}

C++: #define scanf_s scanf
#include <stdio.h>
#include<iostream>
#include <list>
#include <vector>
#include <iostream>
using namespace std;
#define MAX 101

int main()
{
	while (1) {
		int X, Y, r, cou = 0;
		scanf_s("%d %d", &X, &Y);
		if (X == 0 && Y == 0) break;
		if (X < Y) {
			r = X;	X = Y; Y = r;
		}
		 do{
			r = X % Y;
			X = Y; Y = r;
			++cou;
		 } while (r != 0);
		printf("%d %d\n", X, cou);
	}
}