#include<iostream>
using namespace std;
int main(){
  int x,y,mem;
  while(cin>>x>>y){
    if(x==0&&y==0) break;
    int count=0;
    if(y>x){
      mem = x;
      x = y;
      y = mem;
    }
    while(y!=0){
      x %= y;
      mem = x;
      x = y;
      y = mem;
      count++;
      //cout << y << endl;
    }
    cout << x << ' ' << count << endl;
  }
  return 0;
}