N=raw_input()
N = [int(i) for i in N.split()]
m,n = (N[1],N[0]) if N[1] > N[0] else (N[0],N[1])
def gcd(m, n):
    if ((m % n) == 0):
        return n
    else:
        return gcd(n, m % n)
print gcd(m,n) N=raw_input() N raw_input() raw_input int(i) for i in N.split() for i in N.split() i N.split() N.split N split for i in N.split() int(i) int i N = [int(i) for i in N.split()] N [int(i) for i in N.split()] m,n = (N[1],N[0]) if N[1] > N[0] else (N[0],N[1]) m (N[1],N[0]) if N[1] > N[0] else (N[0],N[1]) N[1] > N[0] N[1] N 1 N[0] N 0 (N[1],N[0]) N[1] N 1 N[0] N 0 (N[0],N[1]) N[0] N 0 N[1] N 1 n def gcd(m, n):
    if ((m % n) == 0):
        return n
    else:
        return gcd(n, m % n) gcd if ((m % n) == 0):
        return n
    else:
        return gcd(n, m % n) (m % n) == 0 m % n m n 0 return n n return gcd(n, m % n) gcd(n, m % n) gcd n m % n m n m m n n print gcd(m,n) gcd m n def gcd(m, n):
    if ((m % n) == 0):
        return n
    else:
        return gcd(n, m % n) def gcd(m, n):
    if ((m % n) == 0):
        return n
    else:
        return gcd(n, m % n) gcd n = (N[1],N[0]) if N[1] > N[0] else (N[0],N[1]) (N[1],N[0]) if N[1] > N[0] else (N[0],N[1]) n N=raw_input() raw_input() N N = [int(i) for i in N.split()] [int(i) for i in N.split()] N m,n = (N[1],N[0]) if N[1] > N[0] else (N[0],N[1]) (N[1],N[0]) if N[1] > N[0] else (N[0],N[1]) m
N=raw_input()
N = [int(i) for i in N.split()]
m,n = (N[1],N[0]) if N[1] > N[0] else (N[0],N[1])
def gcd(m, n):
    if ((m % n) == 0):
        return n
    else:
        return gcd(n, m % n)
print gcd(m,n)