from fractions import gcd

n = int(eval(input()))

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

b = a[0]

for i in range(n):

	b = gcd(b, a[i])

print (b)
n = int(eval(input()))

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



def gcd(x, y):

	while y:

		x, y = y, x%y

	return x



def lcm(x,y):

	return (x * y) // gcd(x,y)



c = a[0]

for i in a:

	c = gcd(c,i)

print (c)

from fractions import gcd

n = int(eval(input()))
a = list(map(int, input().split()))
b = a[0]
for i in range(n):
    b = gcd(b, a[i])
print(b)

n = int(eval(input()))
a = list(map(int, input().split()))


def gcd(x, y):
    while y:
        x, y = y, x % y
    return x


def lcm(x, y):
    return (x * y) // gcd(x, y)


c = a[0]
for i in a:
    c = gcd(c, i)
print(c)

-from fractions import gcd - -b = a[0] -for i in range(n): -    b = gcd(b, a[i]) -print(b) + + +def gcd(x, y): +    while y: +        x, y = y, x % y +    return x + + +def lcm(x, y): +    return (x * y) // gcd(x, y) + + +c = a[0] +for i in a: +    c = gcd(c, i) +print(c)