A = [] N, M = map(int, input().split()) while True: if M == 0: break A.append(N // M) N %= M N, M = M, N print(*A)