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<algorithm>
using namespace std;
int s,a,b;
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<bits/stdc++.h>
using namespace std;

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

		int count=0;
		while(b!=0){
		a=a%b;
		swap(a,b);
		count++;

		}
	cout<<a<<" "<<count<<endl;
	}
	return 0;
}

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

int main()
{
	int x,y,temp,step;
	cin>>x>>y;

	while(x!=0){
		if(x-y<0){
			temp=x;
			x=y;
			y=temp;
		}
		step=1;
		for(;;){
			x=x%y;
			temp=x;
			x=y;
			y=temp;
			if(y==0)break;
			step++;
		}
		cout<<x<<" "<<step<<"\n";
		cin>>x>>y;
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	long long int a,s,d,f,g,h,j,i;
	while(1){
		f=0;	
		scanf("%lld %lld",&a,&s);
		if(a==0&&s==0){
			break;
		}
		if(a<s){
			d=s;
			s=a;
			a=d;
		}
		while(1){
			if(s==0){
				break;
			}
			a=a%s;
			d=s;
			s=a;
			a=d;
			f++;
		}
		printf("%lld %lld\n",a,f);
	}
	return 0;
}

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

C++: #include<stdio.h>
 int main(){ 
int a,b; 
while(1){
 scanf("%d%d",&a,&b); 
if(!(a|b))return 0; 
int now=0; if(a<b){ 
int c=a; a=b; b=c;
 } 
while(b!=0){ 
a=a%b; int c=a; a=b; b=c; now++; 
} 
printf("%d %d\n",a,now);
 }

 }

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

unsigned int res=0;

unsigned int gcd(unsigned int x,unsigned int y) {
  if(y == 0) return x;
  else {
    res++;
    return gcd(y,x%y);
  }
}

int main() {
  unsigned int x,y,temp;
  while(cin >> x >> y) {
    if(x==0&&y==0) break;
    if(x < y) {
      temp = x;
      x = y;
      y = temp;
    }
    cout << gcd(x,y) << " " << res << endl;
    res = 0;
  }
}

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 a;
		}
		kaisuu = kaisuu + 1;
		s = 0;
		while (b =! 0) {
			s = s + 1;
			r = a % b;
			a = b;
			b = r;
		}
		kouyaku[kaisuu] = a;
		kazu[kaisuu] = s;
	}
a:;
	for (int i = 1; i <= kaisuu; i++) {
		cout << kouyaku[i] << " " << kazu[i] << endl;
	}
}

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

	return 0;
}

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 x,y,step,tmp;
	while(true){
		cin >> x >> y;
		
		if(!x && !y)
			break;
			
		if(x < y){
			tmp = x;
			x = y;
			y = tmp;
		}
		step = 0;
		
		while(y != 0){
			step++;
			
			x = x%y;
			
			tmp = x;
			x = y;
			y = tmp;
			
			if(!y)
				break;
		}
		cout << x << ' ' << step << endl;
	}
}

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

int res;

int gcd(int x, int y) {
  if(y == 0) return x;

  res++;
  return gcd(y,x%y);

}

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

C++: #include <cstdio>
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;
		int gcd=GCD(x,y);
		printf("%d %d\n",gcd, ans);
	}
}

C++: #include <iostream>
using namespace std;
int main(void){
  	int a,b;

	for (int i = 0; i < 1000; i++){
		cin >> a >> b;

		if (a == 0 & 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 <cstdio>
#include <algorithm>
using namespace std;
int main(){
  int X, Y;
  while(cin >> X >> Y){
    if(X == 0 && Y == 0) break;
    if(X < Y) swap(X, Y);
    int cnt = 0;
    while(Y != 0){
      cnt++;
      X %= Y;
      swap(X, Y);
    }

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,r,count;
  while(1){
    count = 0;
    cin >> a >> b;
    if(a==0 && b==0) break;
    if(a<b) swap(a,b);
    while(b>0){
      r = a % b;
      a = b;
      b = r;
      count++; 
    }
    cout << a << " " << count << endl;
  }
  return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,x,c;
	while(1){
		scanf("%d %d",&a,&b);
		if(a==0&&b==0) break;
		if(a<b){
			x=a; a=b; b=x;
		}
		c=0;
		while(b!=0){
			a=a%b; x=a; a=b; b=x; c++;
		}
		printf("%d %d\n",a,c);
	}
	return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int cnt=0;;
	int i,j,n,m,amari,syo;
	while(1) {
		scanf("%d %d",&n,&m);
		if(n==0 && m==0) break;
		if(n<m) swap(n,m);
		while(1) {
			n=n%m;
			swap(n,m);
			cnt++;
			if(m==0) break;
		}
		
		printf("%d %d\n",n,cnt);
		cnt=0;
	}
	return 0;
}

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

int main(void){
  int i,x,y;

  while(1){
    cin>>x>>y;
    if(!x && !y) break;

    if(x<y) swap(x,y);
    for(i=0;y;i++){
      x = x % y;
      swap(x,y);
    }
    cout<<x<<" "<<i<<endl;
  }

  return 0;
}

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

using namespace std;

int counter;

int gcd(int a, int b){
    int tmp;
    if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
       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)<<" "<<counter<<endl;
    }
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

struct A {
  int c;
  int s;
};

A g(int x, int y) {
  int count = 0;
  while(y > 0) {
    count++;
    x %= y;
    swap(x, y);
  }

  A a;
  a.c = count;
  a.s = x;
  return a;
}

int main() {
  int x, y;
  while(cin >> x >> y) {
    if(!x && !y) return 0;
    A a = g(max(x, y), min(x, y));
    cout << a.s << " " << a.c << endl;
  }
}