n = int(eval(input()))

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



while True:

    min_num = min(a)

    min_ind = a.index(min_num) 

    a = [n % min_num for n in (a[:min_ind] + a[min_ind+1:]) if n % min_num != 0]

    if a == []:

        print(min_num)

        exit()

    a.append(min_num)
n = int(eval(input()))

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



def gcd(a, b):

    while b:

        a, b = b, a%b

    return a



g = a[0]

for n in a:

    g = gcd(g, n)



print(g)
n = int(eval(input()))
a = list(map(int, input().split()))
while True:
    min_num = min(a)
    min_ind = a.index(min_num)
    a = [n % min_num for n in (a[:min_ind] + a[min_ind + 1 :]) if n % min_num != 0]
    if a == []:
        print(min_num)
        exit()
    a.append(min_num)

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


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


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

-while True: -    min_num = min(a) -    min_ind = a.index(min_num) -    a = [n % min_num for n in (a[:min_ind] + a[min_ind + 1 :]) if n % min_num != 0] -    if a == []: -        print(min_num) -        exit() -    a.append(min_num) + + +def gcd(a, b): +    while b: +        a, b = b, a % b +    return a + + +g = a[0] +for n in a: +    g = gcd(g, n) +print(g)