N = int(eval(input()))

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



import fractions



num = a_list[0]



for i in range(N):

    a = a_list[i]

    num = fractions.gcd(num, a)

print(num)

N = int(eval(input()))

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





def gcd(a, b):

    return a if b == 0 else gcd(b, a % b)





ans = a_list[0]



for i in range(N):

    ans = gcd(ans, a_list[i])

print(ans)

N = int(eval(input()))
a_list = list(map(int, input().split()))
import fractions

num = a_list[0]
for i in range(N):
    a = a_list[i]
    num = fractions.gcd(num, a)
print(num)

N = int(eval(input()))
a_list = list(map(int, input().split()))


def gcd(a, b):
    return a if b == 0 else gcd(b, a % b)


ans = a_list[0]
for i in range(N):
    ans = gcd(ans, a_list[i])
print(ans)

-import fractions -num = a_list[0] + +def gcd(a, b): +    return a if b == 0 else gcd(b, a % b) + + +ans = a_list[0] -    a = a_list[i] -    num = fractions.gcd(num, a) -print(num) +    ans = gcd(ans, a_list[i]) +print(ans)