n, m = map(int, input().split()) A = [] while True: if m == 0: break q, r = divmod(n, m) A.append(q) n, m = m, r print(*A)