import sys,random,bisect from collections import deque,defaultdict from heapq import heapify,heappop,heappush from itertools import permutations from math import log,gcd from fractions import Fraction input = lambda :sys.stdin.readline().rstrip() mi = lambda :map(int,input().split()) li = lambda :list(mi()) N,M = mi() A = [] while M: A.append(N//M) N %= M N,M = M,N print(*A)