#include<iostream>
using namespace std;
int main(){
  int x,y;

  while(cin >> x >> y){
    int count=0, temp;
    if(x==0 && y==0) break;
    while(y!=0){
      count++;
      x = x % y;
      temp = x;
      x = y;
      y = temp;
    }
    cout << x  << ' ' << count << endl;
  }
  return 0;
}