import fractions

n = int(eval(input()))

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

ans = a[0]

for i in a[1:]:

    ans = fractions.gcd(ans,i)

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

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

from fractions import gcd

g = a[0]

for i in a[1:]:

    g = gcd(g,i)

print(g)
import fractions

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

n = int(eval(input()))
a = sorted(list(map(int, input().split())))
from fractions import gcd

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

-import fractions +n = int(eval(input())) +a = sorted(list(map(int, input().split()))) +from fractions import gcd -n = int(eval(input())) -a = list(map(int, input().split())) -ans = a[0] +g = a[0] -    ans = fractions.gcd(ans, i) -print(ans) +    g = gcd(g, i) +print(g)