a,b = map(int,input().split())
def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(min(x,y),q)

print(max(gcd(a,b)))
 a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(min(x,y),q) gcd q = max(x,y)  %  min(x,y) q max(x,y)  %  min(x,y) max(x,y) max x y min(x,y) min x y if q == 0 :
        return [min(x,y),0]
     q == 0 q 0 return [min(x,y),0] [min(x,y),0] min(x,y) min x y 0 return gcd(min(x,y),q) gcd(min(x,y),q) gcd min(x,y) min x y q x x y y print(max(gcd(a,b))) print max(gcd(a,b)) max gcd(a,b) gcd a b a,b = map(int,input().split()) map(int,input().split()) a b = map(int,input().split()) map(int,input().split()) b def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(min(x,y),q) def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(min(x,y),q) gcd
a,b = map(int,input().split())
def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return [min(x,y),0]
    return gcd(min(x,y),q)

print(max(gcd(a,b)))

