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

