n, m = map(int, input().split()) ANS = [] q, r = divmod(n, m) ANS.append(q) n = r while n > 1: q, r = divmod(m, n) ANS.append(q) n, m = r, n if n == 1: ANS.append(m) print(*ANS)