n = int(eval(input()))

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

a.sort()



while 1 < len(a):

    while 0 != a[0]:

        r = a[1] % a[0]

        a[1] = a[0]

        a[0] = r

    a.pop(0)

print((a[0]))
n = int(eval(input()))

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

a.sort()



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

    while 0 != a[i - 1]:

        r = a[i] % a[i - 1]

        a[i] = a[i - 1]

        a[i - 1] = r

print((a[-1]))

n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
while 1 < len(a):
    while 0 != a[0]:
        r = a[1] % a[0]
        a[1] = a[0]
        a[0] = r
    a.pop(0)
print((a[0]))

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

-while 1 < len(a): -    while 0 != a[0]: -        r = a[1] % a[0] -        a[1] = a[0] -        a[0] = r -    a.pop(0) -print((a[0])) +for i in range(1, len(a)): +    while 0 != a[i - 1]: +        r = a[i] % a[i - 1] +        a[i] = a[i - 1] +        a[i - 1] = r +print((a[-1]))