def gcd(a, b):

    global queue

    r = a % b

    if r:

        d = a // b

        sb = queue.pop()

        sa = queue.pop()

        sc = tuple(map(lambda x, y: x - d * y, sa, sb))

        queue.append(sb)

        queue.append(sc)

        return gcd(b, r)

    else:

        return b





a, b = list(map(int, input().split()))

queue = [(1, 0, a), (0, 1, b)]

g = gcd(a, b)

x, y, r = queue.pop()

print((x, y))
def gcd(a, b):

    global queue

    r = a % b

    if r:

        d = a // b

        sb = queue.pop()

        sa = queue.pop()

        queue.append(sb)

        queue.append(tuple(map(lambda x, y: x - d * y, sa, sb)))

        return gcd(b, r)

    else:

        return b





a, b = list(map(int, input().split()))

queue = [(1, 0), (0, 1)]

g = gcd(a, b)

print((*queue.pop()))
def gcd(a, b):
    global queue
    r = a % b
    if r:
        d = a // b
        sb = queue.pop()
        sa = queue.pop()
        sc = tuple(map(lambda x, y: x - d * y, sa, sb))
        queue.append(sb)
        queue.append(sc)
        return gcd(b, r)
    else:
        return b


a, b = list(map(int, input().split()))
queue = [(1, 0, a), (0, 1, b)]
g = gcd(a, b)
x, y, r = queue.pop()
print((x, y))

def gcd(a, b):
    global queue
    r = a % b
    if r:
        d = a // b
        sb = queue.pop()
        sa = queue.pop()
        queue.append(sb)
        queue.append(tuple(map(lambda x, y: x - d * y, sa, sb)))
        return gcd(b, r)
    else:
        return b


a, b = list(map(int, input().split()))
queue = [(1, 0), (0, 1)]
g = gcd(a, b)
print((*queue.pop()))

-        sc = tuple(map(lambda x, y: x - d * y, sa, sb)) -        queue.append(sc) +        queue.append(tuple(map(lambda x, y: x - d * y, sa, sb))) -queue = [(1, 0, a), (0, 1, b)] +queue = [(1, 0), (0, 1)] -x, y, r = queue.pop() -print((x, y)) +print((*queue.pop()))