n=int(eval(input()))

a=[int(i) for i in input().split()]



def gcd(a,b):

    while b:

        a,b=b,a%b

    return a



for i in range(n-1):

    ans= gcd(a[i],a[i+1])

    a[i+1]=ans

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

a=[int(i) for i in input().split()]



def gcd(a,b):

    while b:

        a,b=b,a%b

    return a



check=a[0]

for i in range(1,n):

    check=gcd(check,a[i])

print(check)

n = int(eval(input()))
a = [int(i) for i in input().split()]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


for i in range(n - 1):
    ans = gcd(a[i], a[i + 1])
    a[i + 1] = ans
print(ans)

n = int(eval(input()))
a = [int(i) for i in input().split()]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


check = a[0]
for i in range(1, n):
    check = gcd(check, a[i])
print(check)

-for i in range(n - 1): -    ans = gcd(a[i], a[i + 1]) -    a[i + 1] = ans -print(ans) +check = a[0] +for i in range(1, n): +    check = gcd(check, a[i]) +print(check)