n = int(eval(input()))

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



a.sort()

for i in range(1,n):

    while a[i]%a[0] != 0:

        a[0],a[i] = a[i]%a[0],a[0]

else:

    ans = a[0]



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

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



for i in range(1,n):

    while a[i]%a[0] != 0:

        a[0],a[i] = a[i]%a[0],a[0]

else:

    ans = a[0]



print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
for i in range(1, n):
    while a[i] % a[0] != 0:
        a[0], a[i] = a[i] % a[0], a[0]
else:
    ans = a[0]
print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(1, n):
    while a[i] % a[0] != 0:
        a[0], a[i] = a[i] % a[0], a[0]
else:
    ans = a[0]
print(ans)

-a.sort()