import fractions

n = int(eval(input()))



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





ans = al[0]

for a in al:

    ans = fractions.gcd(a,ans)

    

print(ans)

    
n = int(eval(input()))



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





# a,bの最大公約数

def gcd(a, b):

    while b:

        a, b = b, a % b

    return a





# a,bの最小公倍数

def lcm(a, b):

    return a * b // gcd(a, b)





ans = al[0]



for a in al:

    ans = gcd(a, ans)



print(ans)
import fractions

n = int(eval(input()))
al = list(map(int, input().split()))
ans = al[0]
for a in al:
    ans = fractions.gcd(a, ans)
print(ans)

n = int(eval(input()))
al = list(map(int, input().split()))
# a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


# a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)


ans = al[0]
for a in al:
    ans = gcd(a, ans)
print(ans)

-import fractions - +# a,bの最大公約数 +def gcd(a, b): +    while b: +        a, b = b, a % b +    return a + + +# a,bの最小公倍数 +def lcm(a, b): +    return a * b // gcd(a, b) + + -    ans = fractions.gcd(a, ans) +    ans = gcd(a, ans)