def exe(x, y): if y != 0: int_part = x // y numerator = x - y * int_part print(int_part, end=" ") exe(y, numerator) exe(*map(int, input().split()))