a = int(eval(input()))

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

b.sort()

while True:

    c = []

    c.append(b[0])

    for i in range(1, len(b)):

        if b[i] % b[0] != 0:

            c.append(b[i] % b[0])

    if len(b) == 1:

        print((b[0]))

        exit()

    else:

        b = c

        b.sort()

def g_c_d(x, y):

    if x == 0:

        return y

    elif y == 0:

        return x

    else:

        return g_c_d(y, x % y)





a = int(eval(input()))

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

c = 0

for i in range(a):

    c = g_c_d(c, b[i])

print(c)

a = int(eval(input()))
b = list(map(int, input().split()))
b.sort()
while True:
    c = []
    c.append(b[0])
    for i in range(1, len(b)):
        if b[i] % b[0] != 0:
            c.append(b[i] % b[0])
    if len(b) == 1:
        print((b[0]))
        exit()
    else:
        b = c
        b.sort()

def g_c_d(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return g_c_d(y, x % y)


a = int(eval(input()))
b = list(map(int, input().split()))
c = 0
for i in range(a):
    c = g_c_d(c, b[i])
print(c)

+def g_c_d(x, y): +    if x == 0: +        return y +    elif y == 0: +        return x +    else: +        return g_c_d(y, x % y) + + -b.sort() -while True: -    c = [] -    c.append(b[0]) -    for i in range(1, len(b)): -        if b[i] % b[0] != 0: -            c.append(b[i] % b[0]) -    if len(b) == 1: -        print((b[0])) -        exit() -    else: -        b = c -        b.sort() +c = 0 +for i in range(a): +    c = g_c_d(c, b[i]) +print(c)