def gcd(a,b):

    if b == 1:

        return 1

    elif b == 0:

        return a

    else:

        return gcd(b,a%b)



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

if a > b:

    print(gcd(a,b))

else:

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



def gcd(a,b):

    if a < b:

        a,b = b,a

    if a%b==0:

        return b

    else:

        return gcd(b,a%b)



print(gcd(a,b))
def gcd(a, b):
    if b == 1:
        return 1
    elif b == 0:
        return a
    else:
        return gcd(b, a % b)


a, b = list(map(int, input().split(" ")))
if a > b:
    print(gcd(a, b))
else:
    print(gcd(b, a))

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


def gcd(a, b):
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)


print(gcd(a, b))

+a, b = list(map(int, input().split(" "))) + + -    if b == 1: -        return 1 -    elif b == 0: -        return a +    if a < b: +        a, b = b, a +    if a % b == 0: +        return b -a, b = list(map(int, input().split(" "))) -if a > b: -    print(gcd(a, b)) -else: -    print(gcd(b, a)) +print(gcd(a, b))