def e(x,y): if y!=0: print(x//y,end=" ") e(y,x%y) e(*map(int,input().split()))