# import pypyjit # pypyjit.set_param("max_unroll_recursion=-1") from collections import * from functools import * from itertools import * from heapq import * import sys, math,random,time # input = sys.stdin.readline N,M = map(int,input().split()) g = math.gcd(N,M) N//=g M//=g A = [] while N!=M: p,q = divmod(N,M) A.append(p) N,M = M,q if M==0: break print(*A)