#coding:utf-8

x,y = list(map(int,input().split()))

while x%y != 0:

    x,y = y,x%y



print(y)
#coding:utf-8

#1_1_B

def gcd(x, y):

    while x%y != 0:

        x, y = y, x%y

    return y



x, y = list(map(int, input().split()))

print((gcd(x, y)))
# coding:utf-8
x, y = list(map(int, input().split()))
while x % y != 0:
    x, y = y, x % y
print(y)

# coding:utf-8
# 1_1_B
def gcd(x, y):
    while x % y != 0:
        x, y = y, x % y
    return y


x, y = list(map(int, input().split()))
print((gcd(x, y)))

+# 1_1_B +def gcd(x, y): +    while x % y != 0: +        x, y = y, x % y +    return y + + -while x % y != 0: -    x, y = y, x % y -print(y) +print((gcd(x, y)))