def f(n, m): if n == 0 or m == 0: return ans.append(n//m) return f(m, n % m) N, M = map(int, input().split()) ans = [] f(N, M) print(*ans)