#include <iostream>
#include <cstdio>
using namespace std;

int main(){
  int a,b,c;
  while(cin >> a >> b,a+b){
    if(a < b)swap(a,b);
    int cnt = 0;
    while(1){
      c = a%b;
      a = b;
      b = c;
      cnt++;
      if(c == 0)break;
    }
    cout << a <<" "<<cnt <<  endl;
  }
  return 0;
}