
a,b = map(int,input().split())
while True:
    r=a%b
    if r==0:
        break
    else:
        a=b
        b=r
print(b) a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b while True:
    r=a%b
    if r==0:
        break
    else:
        a=b
        b=r True r=a%b r a%b a b if r==0:
        break
    else:
        a=b
        b=r r==0 r 0 break a=b a b b=r b r print(b) print b a,b = map(int,input().split()) map(int,input().split()) a b=r r b a=b b a b = map(int,input().split()) map(int,input().split()) b r=a%b a%b r

a,b = map(int,input().split())
while True:
    r=a%b
    if r==0:
        break
    else:
        a=b
        b=r
print(b)